I've upgraded a rails3 project from clearance 0.8.8 to the latest (0.12.0). followed the wiki instructions to do that.
I'm using an 'admin' prefix to most of the authenticated pages. However, eventhough the routes are all correct, I get a routing error when I try accessing 'session/new'.
I'm overriding the session/new view to apply a specific layout.
Any idea what might be causing of the error?
Here is the output from the logs:
Started GET "/sign_in" for 127.0.0.1 at Wed Oct 05 17:34:05 +0300 2011
ActionController::RoutingError (wrong constant name Clearance/sessionsController)
The routing error turned out to be a conflicting String#camelize with right_aws gem v2.0.0
All you need to do to get clearance working in this case is update right_aws gem
PS: found the answer here (devise routing error)
Related
I have scoured the Internet without finding an adequate solution, so I'm here to ask the SO community for help.
I'm migrating a rails 2 app on Heroku Bamboo to Cedar. Concomitantly, I am moving to rails 3 and ruby 2.0.0 (though I get this error with ruby 1.9.3 as well).
It seems that MongoMapper has undergone a bit a change from 0.8.6, to the point where I can't use our old initializer anymore. I'm attempting to use the latest 0.13.1 version of mongo_mapper.
According to https://devcenter.heroku.com/articles/mongohq, I just need to set config/mongo.yml to:
production:
uri: <%= ENV['MONGOHQ_URL'] %>
and I'm all set (I also commented out the old initializer code). However, it fails with the following connection error:
Feb 05 11:18:28 my-app-name app/web.1: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/uri/generic.rb:214:in `initialize': the scheme mongodb does not accept registry part: heroku:2QMdYzo6z5nmJJsmWAWKd_205umc05tBuP2ZodGaNDZ7N5rE4ns09jhsfFBjmkQ2ls_rfTiVC0lD24Y2byDXbg#candidate.21.mongolayer.com:10499,candidate.4.mongolayer.com:10625 (or bad hostname?) (URI::InvalidURIError)
An invalid URI is understandable, but that's what being fed to me by Heroku. What do I am missing in order to for the uri parser to accept it?
Thank you in advance.
The answer lies in the presence of that comma (,) in the uri. When I removed the second host and the comma, it behaved correctly :-)
Specifically, I created a Heroku ENV variable called MONGOHQ_URL2 without the second host name, then updated my config/mongo.yml to use that one instead.
I'm using Ruby On Rails 3.0.9 and everything works fine on Development env. When I switch to Production env, or I upload it to our server, after sign in I'm taken back to the same Login page. When I check the log, I can see the following:
Started POST "/users/login" for 127.0.0.1 at Thu Oct 03 16:48:13 -0300 2013
Processing by UserSessionsController#create as HTML
Parameters: {"user"=>{"password"=>"[FILTERED]", "login"=>"demo_admin"}, "utf8"=>"✓", "authenticity_token"=>"+7AEoVXZ9XiagEymVUnOhFHnck4rgDu883E/ySMlCxQ="}
Redirected to http://localhost:3000/admin
Completed 302 Found in 111ms
Started GET "/admin" for 127.0.0.1 at Thu Oct 03 16:48:13 -0300 2013
Processing by Admin::DashboardController#index as HTML
Completed 401 Unauthorized in 1ms
I'm using authorization_rules file in order to manage access, but I've got no problem on Dev env, as I said before.
If I place a breakpoint at the admin/dashboard#index action, it won't be executed, as it's not reached. It breaks at httpserver file (I debugged it step by step), but I cannot understand why it works on Dev and not on Prod env.
Please, help.
Thanks,
Brian
UPDATE
I forgor to mention that, in my ApplicationController, there's a before_filter called check_plan_features and the first thing it asks is unless current_user.blank? #redirects to Admin section.
I've noticed that after signing in, using Devise, current_user has the user's value, but when after redirecting to the admin section, it comes back to the same filter, and this time, the current_user is null. So, I assume that, somehow, the user's session is destroyed after trying to access Admin section. But, as this only happens on production environment, I'm still wondering what could be.
I just had this exact problem (using rails 4 and devise 3).
The solution was to add a domain declaration to the config/initializers/session_store.rb file like this:
YourAppName::Application.config.session_store :cookie_store, key: '_your_session', domain: {
production: 'production_domain',
development: 'development_domain'
}.fetch(Rails.env.to_sym, :all)
Though it is important that this was changed initially due to adding sub-domains to the application.
Im building my first Rails app server on a Ubuntu server machine. I came to the point where i am testing a simple add located on the server. When I hit the root page, default rails message
"Welcome on board, You’re riding Ruby on Rails!"
Thats good i suspect. But when I hit server/todos i just get this error message
"We're sorry, but something went wrong."
How can I see full error message? I am completely new to Apache and Passenger. I suspect I could get full messages if i run from the server but there is no GUI or browser installed.
Ok found out this was all connected to the Rails app and not a Apache or Passenger setting.
# environments/production.rb
config.consider_all_requests_local = true
I'm using Rails 3.0.5 version and Ruby 1.9.2 in my application.
Its working fine in development mode but in production mode server goes down after every 3-4 days.
It gives below error in /var/log/https/error.log file.
[Sun Oct 21 09:39:03 2012] [error] [IP_ADDRESS] **Premature end of script headers:**
[ pid=24971 thr=1 file=ext/apache2/Hooks.cpp:817 time=2012-10-21 09:39:03.371 ]:
The backed application (process 29805) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashed; please check whether there are crashing bugs in this application.
I am not getting what's the reason for server down.
which server your using? webrick or else? i got some problem like this in past that server goes down. i changed server from webrick to Mongrel its faster then webrick
Sorry i can't comment so answering, personally haven't come across this problem but there seems to be quite some talk about it. Here are a few resources that i came across:
Dalibor Nasevic's explanation as to why this is happening
Premature end of script headers — Rails
Intermittent “premature end of script headers” with Rails 3.1
Hope it helps.
I am new to rails and have been working thru a number of tutorials. I have a controller with the following actions: Contact and Home. The routes.rb has the following:
SampleApp::Application.routes.draw do
get "pages/home"
get "pages/contact"
# The priority is based upon order of creation:
# first created -> highest priority.
Everything else in the standard routes is commented
When I try to reach the page http://localhost:3000/pages/home
I get
Routing Error
No route matches "/pages/home"
on the web page.
I restarted the rails server and checked routes with rake routes - results below
pages_home GET /pages/home(.:format) {:controller=>"pages", :action=>"home"}
pages_contact GET /pages/contact(.:format) {:controller=>"pages", :action=>"contact"}
I tried other tutorials that were based on 2.3 version of rails and had lots of routing issues but was running 3.0 instead so went to 3.0 tutorial. Same routing issues. I even have the same problem when I put a static page "hello world" in the public folder. According to tutorial, that should just come up but I get same routing error message.
Any suggestions would be most appreciated.
I solved my problem. A real noob mistake. Running rails, it is important to be in the right directory. I was in a previous example directory so the routes I needed were not there.