Rails SSL Google Chrome Issue - ruby-on-rails-3

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.

Related

Getting rails feedback plugin to work on heroku

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.

Ruby on rails error goes on refreshing the browser

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.

WARNING: Can't verify CSRF token authenticity with CKEditor image upload

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

I am using devise and cancan gems. When I sign_in I get redirect back to sign_in page

Here is the log
Started POST "/users/sign_in" for 127.0.0.1 at 2013-05-02 09:57:19 -0400
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"abc=", "user"=>{"email"=>"xyz#abc.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'xyz#abc.com' LIMIT 1
Completed 401 Unauthorized in 9ms
Processing by Devise::SessionsController#new as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"xyz=", "user"=>{"email"=>"xyz#abc.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
Rendered /Users/nitsingh/.rvm/gems/ruby-1.9.3-p392/gems/devise-2.1.3/app/views/devise/shared/_links.erb (0.6ms)
Rendered /Users/nitsingh/.rvm/gems/ruby-1.9.3-p392/gems/devise-2.1.3/app/views/devise/sessions/new.html.erb within layouts/application

Authentication error while fetching yahoo contacts using contacts gem in rails application

I am using contacts gem in my rails 3 application. In case of yahoo contacts it is acting weirdly . It is working fine on local machine but on staging server it is giving authentication error . Below is the log for local and staging server for test account :
on local server :
Started POST "/invitations/new_invitations" for 127.0.0.1 at 2011-08-04 15:31:46 +0530
Processing by InvitationsController#new_invitations as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"TanjgyK36VgohyE/woBmBGYq2DGbPLmts3j+IIG/c1Q=", "provider"=>"yahoo", "email"=>"testvin27#yahoo.in", "pass"=>"123456", "commit"=>"Import your address book"}
User Load (0.4ms) SELECT users.* FROM users WHERE (users.id = 316) LIMIT 1
Rendered invitations/new_invitations.js.erb (1.2ms)
Completed 200 OK in 9594ms (Views: 30.0ms | ActiveRecord: 0.4ms)
on staging server :
Started POST "/invitations/new_invitations" for 14.99.166.38 at 2011-08-04 10:07:34 +0000
Processing by InvitationsController#new_invitations as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ibMbauQlR1yN2bOBZotirAtZa28dMpzL/m9jc5XBP8M=", "provider"=>"yahoo", "email"=>"testvin27#yahoo.in", "pass"=>"123456", "commit"=>"Import your address book"}
User Load (0.2ms) SELECT users.* FROM users WHERE (users.id = 130) LIMIT 1
Contacts::AuthenticationError: Username and password do not match>
Rendered invitations/new_invitations.js.erb (0.4ms)
Any about this kind of behaviour ??