I am stuck with this weird problem. This problem is only in the production server, at local server it works fine.
I checked my production log and found that the error was at line:
ActionView::Template::Error (undefined method `full_name' for nil:NilClass)
But when I refresh the browser the error was gone and page loads normally. I am not sure what was making the error.
Here is my log:
Started GET "/advertisements" for 182.93.88.6 at 2013-07-13 23:47:39 -0700
Processing by AdvertisementsController#index as HTML
Rendered shared/_profile_menu.html.erb (37.8ms)
Rendered advertisements/index.html.erb within layouts/application (38.1ms)
Completed 500 Internal Server Error in 40ms
ActionView::Template::Error (undefined method `full_name' for nil:NilClass):
4: <div class="six columns">
5: <ul class="breadcrumbs hide-for-small">
6: <li>Home</li>
7: <li class="current">
8: <% if current_user %>
9: <%= link_to "#{current_user.full_name unless current_user.full_name.nil?}", user_path(current_user) %>
10: <% else %>
app/views/shared/_profile_menu.html.erb:7:in `_app_views_shared__profile_menu_html_erb__3873584509912802681_40734020'
app/views/advertisements/index.html.erb:1:in `_app_views_advertisements_index_html_erb___4140482918641285695_46665240'
Started GET "/advertisements" for 182.93.88.6 at 2013-07-13 23:47:41 -0700
Processing by AdvertisementsController#index as HTML
Rendered shared/_profile_menu.html.erb (1.4ms)
Rendered advertisements/index.html.erb within layouts/application (5.5ms)
Rendered shared/_head.html.erb (0.9ms)
Rendered shared/_top_link.html.erb (0.0ms)
Rendered shared/_logo.html.erb (0.5ms)
Rendered shared/_header.html.erb (0.9ms)
Rendered shared/_footer.html.erb (6.6ms)
Rendered shared/_popups.html.erb (0.0ms)
Completed 200 OK in 17ms (Views: 14.4ms | ActiveRecord: 1.2ms)
I am using devise for managing user login and full_name is set to accessible attribute in the user.rb Model as:
attr_accessible :full_name
The server environment is set with nginx, unicorn, capistrano and mysql database. Any help will be greatly appreciated. Thanks in advance.
Looks like there has been some sort of Server problem. I redeployed the application and everything worked fine.
Related
I am using the simple rails gem feedback_popup and I have followed all the instructions. It works fine locally but when I push to heroku it no longer sends the email with the feedback though the logs look like it should:
Started POST "/feedback_popup/messages" for 89.27.92.12 at 2013-08-30 08:59:05 +0000
2013-08-30T08:59:05.904701+00:00 app[web.1]:
2013-08-30T08:59:06.008570+00:00 app[web.1]: Sent mail to info#example.com (110ms)
2013-08-30T08:59:06.109094+00:00 app[web.1]: Processing by FeedbackPopup::MessagesController#create as JS
2013-08-30T08:59:06.209392+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"2jo/keno5XMWc1IgnyJUPBAu5vpLi4uzpHIRQrP+HeA=", "feedback_popup_message"=>{"body"=>"why doesn't this work"}, "commit"=>"Send"}
2013-08-30T08:59:06.310876+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/gems/feedback_popup-0.0.1/app/views/feedback_popup/mailer/feedback.text.erb (0.0ms)
2013-08-30T08:59:06.412572+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/gems/feedback_popup-0.0.1/app/views/feedback_popup/messages/create.js.erb (0.1ms)
2013-08-30T08:59:06.513491+00:00 app[web.1]: Completed 200 OK in 118ms (Views: 0.7ms | ActiveRecord: 0.0ms)
2013-08-30T08:59:05.899365+00:00 heroku[router]: at=info method=POST path=/feedback_popup/messages host=www.baybel.com fwd="89.27.92.12" dyno=web.1 connect=1ms service=132ms status=200 bytes=70
I am using MailChimp and that does a perfect job of sending the welcome email when people sign up. Any ideas?
It now works and I can think of two reasons:
1) Heroku didn't like that the config.mail_from was not an email address previously.
2) There were issues precompiling the assets.
When I try to upload an image with CKEditor I get the error WARNING: Can't verify CSRF token authenticity and the following:
Started POST "/ckeditor/attachment_files?CKEditor=blog_entry_body&CKEditorFuncNum=1&langCode=en" for 127.0.0.1 at 2013-05-28 18:38:57 -0500
Processing by Ckeditor::AttachmentFilesController#create as HTML
Parameters: {"upload"=>#<ActionDispatch::Http::UploadedFile:0x0000000231fef0 #original_filename="me.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"upload\"; filename=\"me.jpg\"\r\nContent-Type: image/jpeg\r\n", #tempfile=#<Tempfile:/tmp/RackMultipart20130528-13870-17wbprr>>, "CKEditor"=>"blog_entry_body", "CKEditorFuncNum"=>"1", "langCode"=>"en"}
WARNING: Can't verify CSRF token authenticity
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'M96bQAv-NGdidsn7hypOJA' LIMIT 1
(0.1ms) BEGIN
(0.2ms) ROLLBACK
Rendered text template (0.0ms)
Completed 200 OK in 7ms (Views: 0.8ms | ActiveRecord: 0.7ms)
It looks like it's happening in Ckeditor::AttachmentFilesController#create. But I didn't see this controller get generated when I installed the CKEditor gem. I found in another post that I must skip_before_filter :verify_authenticity_token but like I said, I don't see Ckeditor::AttachmentFilesController#create.
If you're using the ckeditor gem, you can find the controller here:
https://github.com/galetahub/ckeditor/tree/master/app/controllers/ckeditor
However, it looks their config.js has a solution for csrf, IMHO, it's better than doing the skip_before_filer in the controller.
See config.js here:
https://github.com/galetahub/ckeditor/blob/master/app/assets/javascripts/ckeditor/config.js
just started with RefineryCMS, sorry for newbie question. It runs fine locally and deployed luckily on Heroku Cedar stack. Created a page called Home. /pages/home responds fine.
routes.rb
root :to => 'pages#home'
and works on localhost:3000 but on Heroku it gives error.
The app is here:
http://refkocedar.herokuapp.com/home works
http://refkocedar.herokuapp.com/ does not work
How to set Home page to root on Heroku? Thanks for help!
$ heroku logs
2012-04-03T02:19:57+00:00 heroku[router]: GET refkocedar.herokuapp.com/assets/application-ddce3db0fc667014faf95d85d24c71d4.js dyno=web.1 queue=0 wait=0ms service=4ms status=304 bytes=0
2012-04-03T02:19:58+00:00 heroku[router]: GET refkocedar.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=4ms status=304 bytes=0
2012-04-03T02:19:58+00:00 app[web.1]: cache: [GET /favicon.ico] miss
2012-04-03T02:20:04+00:00 app[web.1]:
2012-04-03T02:20:04+00:00 app[web.1]:
2012-04-03T02:20:04+00:00 app[web.1]: Started GET "/" for 80.98.142.244 at 2012-04-03 02:20:04 +0000
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
I was trying Refinery recently on myocal workspace and had a similar issue. Not sure what is different on heroku as I didnt try anything on it. This solution worked for me.
http://groups.google.com/group/refinery-cms/browse_thread/thread/504b72ec2f1575d5
Refinery admin page you have a option as "forward this page" under advanced options. Set "/"
Here I explain step by step how to set up your home as root_path(localhost:3000).
go to http://localhost:3000/refinery/login
1.Then Login with your username and password.
2.Click to Pages
3.click edit link which page you want to see when localhost:3000 loaded.
4.Click Advanced Options
5.Set / in Forward this page to another website or page text box. Then click Save
6.Now your home page will show on localhost:3000
What Sonu linked to from google groups is correct. You need to add the following in your routes.rb:
root :to => 'pages#home'
And then change the setting on your home page (under advanced settings) that says:
Forward this page to another website or page
and have this forwarded to /
This worked for me.
Very short answer. Under "Advanced Options", set "Forward this page to another website or page" to /
It doesn't sound like it should work, but it does.
I'd say this is almost certainly an error with your routes.rb file.
I was working through the Rails Tutorial by Michael Hartl to setup my new app and ran into this error over and over again.
Check to make sure that Heroku knows the correct root path e.g. " root 'application#hello'"
I have this model:
class Book < Item
validates :isbn, :presence => true, :uniqueness => true
has_many :book_chapters
has_many :chapters, :through => :book_chapters
searchable :auto_index => true, :auto_remove => true do
text :title
end
end
And then I have this controller:
class HomeController < ApplicationController
def index
#search = Book.search do
fulltext params[:search]
end
#books = #search.results
[... normal rest of code ...]
end
end
The field "title" is inherited from the more generic Item model. And when the Home controller tries to perform the search, I get this error:
NoMethodError in HomeController#index
undefined method `closed?' for nil:NilClass
There is also this additional warning in the log:
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from /Users/xxx/Sites/zigzag/app/models/book.rb:7)
Which refers to the line:
searchable :auto_index => true, :auto_remove => true do
in book.rb
Any ideas why I'm getting this error? In other similar posts on stack overflow it seems people forgot to turn on the sunspot server. But I'm running it, and its running fine. I can navigate the Solr Admin just fine. Thanks!
I figured it out. I'm running this app on a Mac OS Lion 10.7.2. The issue was that the rails app was not indeed connected within the sunspot server. But the reason isn't because the sunspot server was missing. It was because rails was using IPv4 addresses while sunspot was expecting IPv6 addresses. The first part of the fix was to change the sunspot.yml config file so that the hostname is 127.0.0.1 and not 'localhost.' Then, in /etc/hosts, comment out the following lines:
#::1 localhost
#fe80::1%lo0 localhost
So that 'localhost' only maps to 127.0.0.1 (which is specified elsewhere in /etc/hosts/). That's it!
One simple answer is that you may have not started your sunspot solr. Try running this rake command:
rake sunspot:solr:start
I was away for a week from coding and when I return chrome will not display my rails app with localhost:3000.
The app has SSL on via config.force_ssl = true.
I thought its an app problem, but on firefox it works well.
From the rails server console window, it seems chrome doesn't send the requests right:
[2011-10-07 09:21:46] ERROR bad Request-Line `\x16\x03\x00\x00U\x01\x00\x00Q\x03\x00Nמ¿י!┐°J=סאו$íK┬╦φ°S^ºí`ó\x00\x17█\x1E⌐פ╙\x00\x00*\x00 \x00ט\x00ח\x009\x008\x00ה\x005\x00E\x00D\x00f\x003\x002\x00צ\x00A\x00\x04\x00\x05\x00/\x00\x16\x00\x13■ \x00'.
while on firefox it is
Started GET "/" for 127.0.0.1 at 2011-10-07 09:22:39 +0200
Processing by PagesController#home as HTML
←[1m←[36mUser Load (0.0ms)←[0m ←[1mSELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1←[0m
Rendered pages/home.html.erb within layouts/application (372.0ms)
←[1m←[35mCACHE (0.0ms)←[0m SELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1
←[1m←[36mCACHE (0.0ms)←[0m ←[1mSELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1←[0m
Rendered layouts/_header.html.erb (2.0ms)
Rendered layouts/_footer.html.erb (0.0ms)
Completed 200 OK in 613ms (Views: 610.0ms | ActiveRecord: 3.0ms)
Anyone know how to fix chrome to work?
Thanks
Try to clear your cache first.