YPU
asked on
Upgrade Ruby from 1.8.7 to 1.9.2-p320
I recently upgraded my web app from Ruby 1.8.7 to 1.9.2-p320 and while there were a few hiccups, most everything was minor.
However, I am having one major issue that is baffling me. I've been spinning my wheels for over a day now and that is never a good thing.
In several instances within my app, I am using ajax requests to process updates. This was working flawlessly when I was running Ruby 1.8.7, but now I am getting the following error (taken from firebug console):
<h1>ActionController::Meth odNotAllow ed</h1>
<pre>Only get requests are allowed.</pre>
I am using the following plugins to make this code work:
jrails
less-js-routes
I have applied all of the Ruby 1.9 patches but I keep getting the 405 Method Not Allowed Error when attempting to run things like:
Does anyone have any ideas? I am fresh out of them.
Thanks.
However, I am having one major issue that is baffling me. I've been spinning my wheels for over a day now and that is never a good thing.
In several instances within my app, I am using ajax requests to process updates. This was working flawlessly when I was running Ruby 1.8.7, but now I am getting the following error (taken from firebug console):
<h1>ActionController::Meth
<pre>Only get requests are allowed.</pre>
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/routing/recognition_optimisation.rb:64:in `recognize_path'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/routing/route_set.rb:442:in `recognize'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/routing/route_set.rb:437:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/dispatcher.rb:87:in `dispatch'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/dispatcher.rb:121:in `_call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/dispatcher.rb:130:in `block in build_middleware_stack'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-2.3.17/lib/active_record/query_cache.rb:29:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-2.3.17/lib/active_record/query_cache.rb:29:in `block in call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-2.3.17/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-2.3.17/lib/active_record/query_cache.rb:9:in `cache'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-2.3.17/lib/active_record/query_cache.rb:28:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-2.3.17/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/string_coercion.rb:25:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/head.rb:9:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/methodoverride.rb:24:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/params_parser.rb:15:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/session/cookie_store.rb:99:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/hoptoad_notifier-2.4.11/lib/hoptoad_notifier/rack.rb:27:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/failsafe.rb:26:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/hoptoad_notifier-2.4.11/lib/hoptoad_notifier/user_informer.rb:12:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/lock.rb:11:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/dispatcher.rb:114:in `block in call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/reloader.rb:34:in `run'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-2.3.17/lib/action_controller/dispatcher.rb:108:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.3.17/lib/rails/rack/static.rb:31:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/urlmap.rb:47:in `block in call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/urlmap.rb:41:in `each'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/urlmap.rb:41:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.3.17/lib/rails/rack/debugger.rb:19:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.3.17/lib/rails/rack/log_tailer.rb:17:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/content_length.rb:13:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/chunked.rb:15:in `call'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/rack-1.1.6/lib/rack/handler/mongrel.rb:67:in `process'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:165:in `block in process_client'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:164:in `each'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:164:in `process_client'
/Users/nathanarnold/.rvm/gems/ruby-1.9.2-p320/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:291:in `block (2 levels) in run'
I am using the following plugins to make this code work:
jrails
less-js-routes
I have applied all of the Ruby 1.9 patches but I keep getting the 405 Method Not Allowed Error when attempting to run things like:
<a href="#" id="edit_coupon" onclick="jQuery.ajax({data:'', dataType:'script', type:'post', url:'/coupons/60/edit'}); return false;">Edit</a>
Does anyone have any ideas? I am fresh out of them.
Thanks.
Can you post your routes.rb file please?
ASKER
ActionController::Routing::Routes.draw do |map|
map.resources :businesses,
:collection => {
:preview => :get,
},
:member => {
:take_ownership => :get,
:create_ownership => :post,
:edit_popup => :get,
:rate => :put,
:contact => :any,
} do |business|
business.resource :about_us, :controller => 'business_about_us'
business.resource :address, :controller => 'business_addresses'
business.resource :billing_info, :controller => 'business_billing_info'
business.resources :content_blocks, :controller => 'business_content_blocks'
business.resource :hours_of_operation, :controller => 'business_hours_of_operation'
business.resource :status_update
business.resource :video, :controller => 'business_video'
business.resources :photos, :controller => 'business_photos',
:member => {
:cancel => :get,
:crop => :get,
:rotate => :get,
:save => :get
}
business.resources :reviews, :controller => 'business_reviews'
end
map.namespace :service_credentials do |creds|
creds.resources :twitter,
:only => [],
:collection => {
:login => :get,
:logout => :get,
:callback => :get,
:toggle_default => :get
}, :controller => 'twitter_credentials'
creds.resources :facebook,
:only => [],
:collection => {
:logout => :get,
:callback => :get,
:toggle_default => :get
}, :controller => 'facebook_credentials'
end
map.resources :cities
map.resources :messages,
:member => {
:delete => :put,
:mark_as_unread => :put,
:reply => :any
}
map.resources :reviews,
:member => {
:mark_as_unread => :put,
:reply => :any,
:suspend => :any
}
map.resources :coupons,
:member => {
:activate => :get,
:deactivate => :get
}
map.traffic 'traffic', :controller => 'traffic'
map.lifetime 'lifetime.:format', :controller => 'traffic', :action => 'lifetime'
map.resource :session
map.resources :users,
:collection => {
:terms => :get
},
:member => {
:cancel => :get
}
map.namespace :backend do |backend|
backend.resources :business_comparisons, :only => [:index, :show]
backend.resources :businesses, :only => [:index], :member => { :pull => [:get, :post] }
backend.resources :users, :only => [:index]
end
map.namespace :crossroad do |crossroad|
crossroad.resources :business, :member => {:cancel => :delete}
end
map.rating '/businesses/:id/rate/:rating', :controller => 'businesses', :action => 'rate', :method => :put
map.categories_for_city 'categories/:id/for/:city', :controller => 'categories', :action => 'show'
map.about 'yellow-pages-united', :controller => 'content', :action => 'about'
map.abuse 'abuse', :controller => 'content', :action => 'abuse'
map.privacy 'privacy', :controller => 'content', :action => 'privacy'
map.sitemap 'sitemap', :controller => 'content', :action => 'sitemap'
map.contact_ypu 'contact_ypu', :controller => 'content', :action => 'contact_ypu'
map.help 'help', :controller => 'content', :action => 'help'
map.featured 'featured', :controller => 'content', :action => 'featured'
map.featured 'recent', :controller => 'content', :action => 'recent'
map.learn_how 'learn_how', :controller => 'content', :action => 'learn_how'
map.phone_search 'phone_search', :controller => 'content', :action => 'phone_search'
map.dashboard 'dashboard', :controller => 'dashboard'
map.formatted_search 'search.:format', :controller => 'search'
map.new_search 'searching', :controller => 'search', :action => 'new'
map.search 'search', :controller => 'search'
map.forgot_password 'forgot_password', :controller => 'sessions', :action => 'forgot_password'
map.login 'login', :controller => 'sessions', :action => 'new'
map.logout 'logout', :controller => 'sessions', :action => 'destroy'
map.reset_password 'reset_password', :controller => 'sessions', :action => 'reset_password'
map.root :controller => 'content'
end
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The above now works with the following:
business.resources :photos, :controller => 'business_photos',
:member => {
:cancel => :get,
:crop => :get,
:rotate => :get,
:save => :get,
:show => :post
}
ASKER
SO, now I guess my question is:
What changed from Ruby 1.8 to 1.9 that makes me have to set those routes?
What changed from Ruby 1.8 to 1.9 that makes me have to set those routes?