i am using rails 3.0.3 and i recently installed ckeditor to add text editor in my articles.before adding this editor everything was working fine.but after installing ckeditor(followed this : https://github.com/hificreative/rails-3-ckeditor) i am getting text editor in my articles page but i am getting routes error in console and i am not able to save data on clicking save button...
console output :
Started GET "/javascripts/reset.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/reset.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.5ms)
Started GET "/javascripts/grid.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/grid.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)
Started GET "/javascripts/style.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/style.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.2ms)
ActionController::RoutingError (No route matches "/javascripts/style.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.2ms)
Started GET "/javascripts/messages.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/messages.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.8ms)
Started GET "/javascripts/forms.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/forms.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.4ms)
i have included following in my gemfile :
gem 'ckeditor', '3.5.0'
following are the steps that i followed to install ckeditor:
Next step is generate ckeditor js files and configuration file Check “config/initializers/ckeditor.rb” for more configuration options:
rails generate ckeditor:base
Generate ckeditor models for file upload support: For paperclip:
rails generate ckeditor:migration
For attachment_fu:
rails generate ckeditor:migration --backend=attachment_fu
Don’t forget about migration:
rake db:migarte
included following line in my lauout.application.html.haml file
= javascript_include_tag :ckeditor
and wrote following line in my articles _form.html.haml file
form.cktext_area :content
how to solve this error.....
Not sure I can help with that particular gem but I just installed using this one with instant success.
https://github.com/galetahub/ckeditor
Ok, I just restarted my PC and then everything started working normally, without this error.
Related
I got an app that runs fine locally and on production (deployed with capistrano) and I'm trying to set up a staging environment which worked so far except for devise.
When I try to log in with working user credentials I get redirected to the root path but not logged in.
Logs:
Started POST "/login" for 95.91.228.167 at 2016-01-31 13:33:51 +0000
Processing by PagesController#index as HTML
Rendered shared/_sidebar.html.erb (0.2ms)
Completed 200 OK in 2.7ms (Views: 2.1ms | ActiveRecord: 0.0ms)
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"iHo8UfHuZ9S6GVbj3hAvfzqwo67FfZwZtdhwJ2qTk3Q=", "user"=>{"email"=>"xxx#xxx.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Einloggen"}
WARNING: Can't verify CSRF token authenticity
Redirected to http://xxx.herokuapp.com/
Completed 302 Found in 81.5ms (ActiveRecord: 0.0ms)
Started GET "/" for 95.91.228.167 at 2016-01-31 13:33:51 +0000
Rendered pages/index.html.erb within layouts/application (0.5ms)
I tried all solutions posted here like changing the domain in session_store and I updated devise to the most recent version.
Any ideas? If you need more information, please let me know.
As it turned out session_store.rb had domain: :all which I thought was fine. Once I changed it to xxx.herokuapp.com, it worked. Thanks!
--- Update 1 ---
Now that it works on heroku, it doesn't work on the production server anymore - obviously because of the wrong URL in session_store. What to do now?
--- Update 2 ---
Solved this by using environment variables
I'm a beginner and just installed everything on my system (new) per the Hartl guide. I am having issues with 'rails s' - it hangs and doesn't continue so I'm unable to do anything except end the command line processes and start over. Here's where it stops:
$ rails s
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on (localhost3000)
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-01-03 00:13:30] INFO WEBrick 1.3.1
[2014-01-03 00:13:30] INFO ruby 2.0.0 (2013-11-22) [x86_64-darwin13.0.0]
[2014-01-03 00:13:30] INFO WEBrick::HTTPServer#start: pid=22805 port=3000
Started GET "/microposts/new" for 127.0.0.1 at 2014-01-03 00:13:38 -0800
ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by MicropostsController#new as HTML
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Rendered microposts/_form.html.erb (71.3ms)
Rendered microposts/new.html.erb within layouts/application (90.6ms)
Completed 200 OK in 237ms (Views: 222.5ms | ActiveRecord: 0.4ms)
Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/microposts.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800
Started GET "/assets/microposts.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:40 -0800
Started GET "/microposts/new" for 127.0.0.1 at 2014-01-03 00:19:11 -0800
Processing by MicropostsController#new as HTML
Rendered microposts/_form.html.erb (6.1ms)
Rendered microposts/new.html.erb within layouts/application (8.0ms)
Completed 200 OK in 19ms (Views: 17.9ms | ActiveRecord: 0.0ms)
Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/microposts.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/microposts.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800
As stated, rails server takes over the terminal when you run it. You've got to start a new terminal session. A quit step in ubuntu/linux is the combination
CTL+SHIFT+T
or
CTL+ALT+T
When you run "rails s" it takes over the terminal and doesn't return. You should open a second terminal if you want to run other commands at the same time.
In production you usually setup rails with apache or nginx. See this guide for more information:
http://rubyonrails.org/deploy
I had this same question at first. It look like it's hanging but that actually means that it's running. As long as it looks like it's hanging it is running the server and you can open the localhost:3000 to see your webpage locally. When you're ready to shutdown the server and get your prompt back you can click control c on the mac.
Rails is returning blank HTML when running in production.
The tests I describe bellow are done with the following line: wget http://localhost:3000/login -O here.txt ; cat here.txt. I expect see some HTML being output after executing it.
On my server, I can see the HTML being rendered when I start rails in development mode, using the command rails s. I can see the following in the log:
Started GET "/login" for 127.0.0.1 at 2013-08-21 18:30:32 +0000
Processing by UserSessionsController#new as */*
Rendered user_sessions/_login.html.haml (59.5ms)
Rendered user_sessions/new.html.haml within layouts/application (62.8ms)
Compiled bootstrap-datepicker.css (0ms) (pid 8050)
Compiled application.css (4ms) (pid 8050)
Compiled bootstrap.min.css (0ms) (pid 8050)
# lots of Compiled lines
Rendered layouts/_navigation.html.haml (3.2ms)
Rendered layouts/_messages.html.haml (1.0ms)
Completed 200 OK in 1404ms (Views: 1395.6ms | ActiveRecord: 0.8ms)
When starting my application with RAILS_ENV=production rails s, doing the same request, I got the following on the log:
Started GET "/login" for 127.0.0.1 at 2013-08-21 18:30:52 +0000
Processing by UserSessionsController#new as */*
Rendered user_sessions/_login.html.haml (57.8ms)
Rendered user_sessions/new.html.haml within layouts/application (60.9ms)
Completed 200 OK in 69ms (ActiveRecord: 0.9ms)
But no HTML is output. What is happening? Why this is not working the same way that it does on development?
I use rails 3.2.13, and in this test it runs with WEBrick. I also am using RVM if that matters.
Update: Using the content of config/environments/development.rb on config/environments/production.rb does not fix the problem
The problem is that I was rescuing an exception on ApplicationController and not handling it properly by a logical error. The exception was not raised on development mode.
I use ruby-openid to allow auth with openid
when i use ruby 1.8 with rails as below:
ii rails 2.3.5-1.2+squeeze1 MVC ruby based framework geared for web application development
ii rails-ruby1.8 2.3.5-1.2+squeeze1 MVC ruby based framework geared for web application development
ii rake 0.8.7-2 a ruby build program
ii ruby 4.5 An interpreter of object-oriented scripting language Ruby
ii ruby1.8 1.8.7.302-2squeeze1 Interpreter of object-oriented scripting language Ruby 1.8
ii ruby1.8-dev 1.8.7.302-2squeeze1 Header files for compiling extension modules for the Ruby 1.8
ii rubygems 1.3.7-3 package management framework for Ruby libraries/applications
ii rubygems1.8 1.3.7-3 package management framework for Ruby libraries/applications
everything work fine.
but when i update to:
ruby 1.9.3p125 (2012-02-16) [x86_64-linux]
Rails 3.2.2
1.8.11
after auth succ from the the OpenID Provider and return to my page, exception raised:
Verification failed: Unexpected parameter (not on return_to): 'controller'=nil)
i try to read idres.rb and found:
#message.get_args(BARE_NS).each_pair do |bare_key, bare_val|
rt_val = return_to_parsed_query[bare_key]
if not return_to_parsed_query.has_key? bare_key
# This may be caused by your web framework throwing extra
# entries in to your parameters hash that were not GET or
# POST parameters. For example, Rails has been known to
# add "controller" and "action" keys; another server adds
# at least a "format" key.
raise ProtocolError, ("Unexpected parameter (not on return_to): "\
"'#{bare_key}'=#{rt_val.inspect})")
end
if rt_val != bare_val
raise ProtocolError, ("Parameter '#{bare_key}' value "\
"#{bare_val.inspect} does not match "\
"return_to's value #{rt_val.inspect}")
i am a newbie to ruby. how to solve this ? thanks very much
log below:
Started GET "/consumer/start" for 218.107.55.254 at 2012-03-06 18:12:26 +0800 Processing by ConsumerController#start as HTML Redirected to http://pip.verisignlabs.com/server?openid.assoc_handle=e25c42b0-6774-11e1-9fdb-8f540be9bc3e&openid.claimed_id=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.identity=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&openid.realm=http%3A%2F%2F114.113.197.25%3A3000%2Fconsumer&openid.return_to=http%3A%2F%2F114.113.197.25%3A3000%2Fconsumer%2Fcomplete%3Fdid_sreg%3Dy&openid.sreg.required=email%2Cnickname%2Cfullname Completed 302 Found in 4914ms (ActiveRecord: 0.0ms)
Started GET "/consumer/complete?did_sreg=y&openid.sreg.fullname=tiredboy&openid.assoc_handle=e25c42b0-6774-11e1-9fdb-8f540be9bc3e&openid.response_nonce=2012-03-06T10%3A12%3A32ZzI16RQ%3D%3D&openid.sreg.email=stumyreg%40gmail.com&openid.sreg.nickname=tiredboy&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=http%3A%2F%2Fpip.verisignlabs.com%2Fserver&openid.pape.auth_policies=http%3A%2F%2Fschemas.openid.net%2Fpape%2Fpolicies%2F2007%2F06%2Fnone&openid.claimed_id=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.sig=yNsdpak%2FyNi%2BcFp0oxmjtL3DmoY%3D&openid.identity=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.auth_time=2012-03-06T07%3A16%3A09Z&openid.signed=assoc_handle%2Cidentity%2Cresponse_nonce%2Creturn_to%2Cclaimed_id%2Cop_endpoint%2Cns.sreg%2Csreg.nickname%2Csreg.email%2Csreg.fullname%2Cns.pape%2Cpape.auth_policies%2Cpape.auth_time&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&openid.return_to=http%3A%2F%2F114.113.197.25%3A3000%2Fconsumer%2Fcomplete%3Fdid_sreg%3Dy" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Processing by ConsumerController#complete as HTML Parameters: {"did_sreg"=>"y", "openid.sreg.fullname"=>"tiredboy", "openid.assoc_handle"=>"e25c42b0-6774-11e1-9fdb-8f540be9bc3e", "openid.response_nonce"=>"2012-03-06T10:12:32ZzI16RQ==", "openid.sreg.email"=>"stumyreg#gmail.com", "openid.sreg.nickname"=>"tiredboy", "openid.ns"=>"http://specs.openid.net/auth/2.0", "openid.mode"=>"id_res", "openid.op_endpoint"=>"http://pip.verisignlabs.com/server", "openid.pape.auth_policies"=>"http://schemas.openid.net/pape/policies/2007/06/none", "openid.claimed_id"=>"http://stutiredboy.pip.verisignlabs.com/", "openid.sig"=>"yNsdpak/yNi+cFp0oxmjtL3DmoY=", "openid.identity"=>"http://stutiredboy.pip.verisignlabs.com/", "openid.ns.pape"=>"http://specs.openid.net/extensions/pape/1.0", "openid.pape.auth_time"=>"2012-03-06T07:16:09Z", "openid.signed"=>"assoc_handle,identity,response_nonce,return_to,claimed_id,op_endpoint,ns.sreg,sreg.nickname,sreg.email,sreg.fullname,ns.pape,pape.auth_policies,pape.auth_time", "openid.ns.sreg"=>"http://openid.net/extensions/sreg/1.1", "openid.return_to"=>"http://114.113.197.25:3000/consumer/complete?did_sreg=y"} Redirected to http://114.113.197.25:3000/consumer Completed 302 Found in 3ms (ActiveRecord: 0.0ms)
Started GET "/consumer" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Processing by ConsumerController#index as HTML Rendered consumer/index.html within layouts/application (0.3ms) Completed 200 OK in 3ms (Views: 3.0ms | ActiveRecord: 0.0ms)
Started GET "/assets/application.css?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /application.css - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/jquery_ujs.js?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /jquery_ujs.js - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/application.js?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /application.js - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/jquery.js?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /jquery.js - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
*** /usr/local/ruby/lib/ruby/gems/1.9.1/gems/ruby-openid-2.1.8/lib/openid/consumer/idres.rb 2012-03-06 15:13:54.000000000 +0800
--- /home/tiredboy/login/gem/ruby/1.9.1/gems/ruby-openid-2.1.8/lib/openid/consumer/idres.rb 2012-03-07 13:25:58.000000000 +0800
***************
*** 170,175 ****
--- 170,178 ----
end
#message.get_args(BARE_NS).each_pair do |bare_key, bare_val|
rt_val = return_to_parsed_query[bare_key]
+ if bare_key == "controller" or bare_key == "action"
+ next
+ end
if not return_to_parsed_query.has_key? bare_key
# This may be caused by your web framework throwing extra
# entries in to your parameters hash that were not GET or
i ignore controller and action as temporary solution
It's problem created by Rails, it sometimes adds some parameters like "controller" and "action" in the url.
Instead of modifying the source of idres.rb, you can modify your Rails controller in which you manage the return call in this way:
parameters = params.reject{|k,v|request.path_parameters[k]}.reject{|k,v| k == 'action' || k == 'controller'}
like I found in an issue on the ruby-openid gem on GitHub
This solved the problem for me.
During development of Ruby on Rails applications I have the development log constantly tailing via tail -f log/development.log.
I have only started developing in Rails a few weeks ago, so I don't know if the log has always shown this many entries, but I believe assets have just recently been added in 3.1. Regardless, this is an exerpt of my development.log for a page call:
Started GET "/assets/reset.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Served asset /reset.css - 304 Not Modified (1ms)
Started GET "/assets/style.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Served asset /style.css - 304 Not Modified (0ms)
Started GET "/assets/application.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Started asset /application.css - 304 Not Modified (0ms)
Started GET "/assets/application.js?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Served asset /application.js - 200 OK (1ms)
There are actually a few more entried, but I think you got the picture of this taking up a lot of space with all the new lines in between each GET request. I also delete all the unused scss and coffee files that Rails creates when using generate.
I just want to see all database calls and actual page calls in my development.log when I tail it.
I was wondering if anyone knows of a way to stop Rails logging these events, or if there is a | grep way of excluding everything related to assets.
Help is much appretiated, thanks.
In your config/environments/development.rb set
config.assets.debug = false