Shai Sayfanaltman
2008-Feb-11 11:36 UTC
can''t update my data base using "update_attributes"
Hello,
I have this problem that my rails application works fine in development
environment on my local Linux and windows system but when I uploaded it
to work on the server in production environment I have this problem as
listed in the pasted log file at the end of this entry:
NoMethodError (undefined method `[]'' for nil:NilClass):
/app/controllers/admin_controller.rb:201:in `update''
the support team could not crack this one. I would think that the method
"update_attributes" would just work. if I enter a new entry to the
data
base "mysql" it works fine and also the sort works fine in updating
the
data base.
I have attached the controller file. all the functions work except for
the update one and only when it is running on the hosting server under
production environment.
I do not understand why it says in the log file nilclass when the return
@params is not nil.
Hope someone can help me on this one.
****************************************
********* controller *******************
****************************************
def update
if session[:project_cat].nil? then
redirect_to :action => ''index''
else
@category = Parent.find_by_cat_name(session[:project_cat])
if @category.cat_name == "branding" then
@project = @category.brandings.find(params[:id])
elsif @category.cat_name == "client_say" then
@project = @category.client_says.find(params[:id])
else
@project = @category.projects.find(params[:id])
end
if @project.update_attributes(@params[:project]) # this is line 201
flash[:notice] = ''Project was successfully updated.''
redirect_to :action => ''show'', :id => @project,
:cat_name =>
@category.id
else
render :action => ''edit'', :cat_name => @category.id
end
end
end
****************************************
***** log file *************************
****************************************
Processing AdminController#update (for 81.3.100.245 at 2008-02-07
05:22:08) [POST]
Session ID:
BAh7CjoWcHJvamVjdF9pbWFnZV91cmx7ADoQcHJvamVjdF9jYXQiCW1pc2M6%0ACXVzZXJpBzoOcmV0dXJuX3RvMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxl%0Acjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--be44b352117c1f931fe6eb0eab2a7f0b99ab8edd
Parameters: {"commit"=>"Save",
"cat_name"=>"3",
"project"=>{"tags"=>"flash private",
"client"=>"Mom & Dad",
"description"=>"A movie clip for my parent''s 35
anniversary",
"url_link"=>""},
"action"=>"update", "id"=>"25",
"controller"=>"admin"}
NoMethodError (undefined method `[]'' for nil:NilClass):
/app/controllers/admin_controller.rb:201:in `update''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
`send''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
`perform_action_without_filters''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in
`call_filters''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue''
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in
`perform_action''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in
`cache''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in
`perform_action''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`send''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`process_without_filters''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in
`process_without_session_management_support''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
`process''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in
`process''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
`handle_request''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
`dispatch''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
`dispatch_cgi''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
`dispatch''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/rails.rb:76:in
`process''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/rails.rb:74:in
`synchronize''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/rails.rb:74:in
`process''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:159:in
`process_client''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:158:in
`each''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:158:in
`process_client''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:285:in
`run''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:285:in
`initialize''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:285:in
`new''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:285:in
`run''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:268:in
`initialize''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:268:in
`new''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:268:in
`run''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/configurator.rb:282:in
`run''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/configurator.rb:281:in
`each''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/configurator.rb:281:in
`run''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:128:in
`run''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/command.rb:212:in
`run''
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:281
Rendering /home/saydigi/saydigitaldesign/public/500.html (500 Internal
Server Error)
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Feb-11 12:05 UTC
Re: can''t update my data base using "update_attributes"
On 11 Feb 2008, at 11:36, Shai Sayfanaltman wrote:> > Hello, > > I have this problem that my rails application works fine in > development > environment on my local Linux and windows system but when I uploaded > it > to work on the server in production environment I have this problem > as > listed in the pasted log file at the end of this entry: > NoMethodError (undefined method `[]'' for nil:NilClass): > /app/controllers/admin_controller.rb:201:in `update'' > > the support team could not crack this one. I would think that the > method > "update_attributes" would just work. if I enter a new entry to the > data > base "mysql" it works fine and also the sort works fine in updating > the > data base. > I have attached the controller file. all the functions work except for > the update one and only when it is running on the hosting server under > production environment. > > > if @project.update_attributes(@params[:project]) # this is line 201You''re using @params, which doesn''t exist in rails 2.0. Use params instead It did exist in previous versions. Are you developing against a different version than you are deploying with? Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You''ve written @params instead of params. There is no @ sign needed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Sayfanaltman
2008-Feb-11 13:28 UTC
Re: can''t update my data base using "update_attributes"
Thanks, it did the job. I can''t believe I missed that one. Shai Frederick Cheung wrote:> On 11 Feb 2008, at 11:36, Shai Sayfanaltman wrote: > >> NoMethodError (undefined method `[]'' for nil:NilClass): >> the update one and only when it is running on the hosting server under >> production environment. >> >> >> if @project.update_attributes(@params[:project]) # this is line 201 > > You''re using @params, which doesn''t exist in rails 2.0. Use params > instead > It did exist in previous versions. Are you developing against a > different version than you are deploying with? > > Fred-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- NoMethodError (undefined method `to_sym' for {"6"=>"1"}:Hash
- Why would ActiveRecord connect to Postgres as root?
- Deploying to a staging server using Capistrano: how to start up BackgrounDRb?
- attachment_fu and/or rmagick on osx -- weird error
- NoMethodError : undefined method `stringify_keys!' for "2":String