On 5 Mar 2009, at 19:36, EduardoChinchilla wrote:
> > Thanks Frederick I really appreciate your continued support through > this list. > That to me looks like your code actually reads params(:property) rather than params[:property] Fred > This is what I have: > > ArgumentError (wrong number of arguments (1 for 0)): > /app/controllers/properties_controller.rb:10:in `params' > /app/controllers/properties_controller.rb:10:in `create' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > base.rb:1253:in `send' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > base.rb:1253:in `perform_action_without_filters' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > filters.rb:617:in `call_filters' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > filters.rb:610:in `perform_action_without_benchmark' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > benchmarking.rb:68:in `perform_action_without_rescue' > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > benchmarking.rb:68:in `perform_action_without_rescue' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > rescue.rb:136:in `perform_action_without_caching' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > caching/sql_cache.rb:13:in `perform_action' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > connection_adapters/abstract/query_cache.rb:34:in `cache' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > query_cache.rb:8:in `cache' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > caching/sql_cache.rb:12:in `perform_action' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > base.rb:524:in `send' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > base.rb:524:in `process_without_filters' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > filters.rb:606:in `process_without_session_management_support' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > session_management.rb:134:in `process' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > base.rb:392:in `process' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > dispatcher.rb:183:in `handle_request' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > dispatcher.rb:110:in `dispatch_unlocked' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > dispatcher.rb:123:in `dispatch' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > dispatcher.rb:122:in `synchronize' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > dispatcher.rb:122:in `dispatch' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > dispatcher.rb:132:in `dispatch_cgi' > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ > dispatcher.rb:39:in `dispatch' > /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb: > 103:in `handle_dispatch' > /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb: > 74:in `service' > /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' > /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' > /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' > /usr/lib/ruby/1.8/webrick/server.rb:162:in `start' > /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' > /usr/lib/ruby/1.8/webrick/server.rb:95:in `start' > /usr/lib/ruby/1.8/webrick/server.rb:92:in `each' > /usr/lib/ruby/1.8/webrick/server.rb:92:in `start' > /usr/lib/ruby/1.8/webrick/server.rb:23:in `start' > /usr/lib/ruby/1.8/webrick/server.rb:82:in `start' > /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb: > 60:in `dispatch' > /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/ > webrick.rb:66 > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require' > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in > `require' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:153:in `require' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:521:in `new_constants_in' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:153:in `require' > /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require' > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in > `require' > script/server:3 > > Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/templates/rescues/_trace (98.5ms) > Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/templates/rescues/_request_and_response (1.9ms) > Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/templates/rescues/layout.erb (internal_server_error) > > > On Mar 5, 11:48 am, Frederick Cheung <[email protected]> > wrote: >> On 5 Mar 2009, at 16:50, EduardoChinchilla wrote: >> >> >> >>> Thanks Frederick: >> >>> Sorry I mistyped the method definition, the correct is: >> >>> def create >>> @property = Property.new (params[:property]) >>> end >> >>> Given that I had the error mentioned. >> >>> Any thoughts? >> >> Not without a stack trace (ruby should warn you that you should write >> Property.new(params[:property]) but I don't think that would change >> much). >> >> Fred >> >> >> >>> On Mar 5, 8:59 am, Frederick Cheung <[email protected]> >>> wrote: >>>> On 5 Mar 2009, at 14:31, EduardoChinchilla wrote: >> >>>>> Hi folks: >> >>>>> In my create action I´m getting this messagge: >> >>>>> ArgumentError (wrong number of arguments (1 for 0)): >> >>>>> What does this means? Do i´m passing more or less parameters than >>>>> needed? >>>>> Any guidance would be very appreciated >> >>>>> I´m using a form with 3 models, including a model to attach images >>>>> with Paperclip >> >>>>> The create action is pretty standard: >> >>>>> def create >>>>> @property = Property.new (:property) >>>>> end >> >>>> I suspect the line raising that is somewhere inside active record. >>>> Assuming Property is an ActiveRecord method it's expecting a hash >>>> to >>>> be passed ( eg params[:property] ) but you're just passing the >>>> symbol >>>> property. >> >>>> Fred >> >>>>> These are the parameter: >> >>>>> Processing PropertiesController#create (for 127.0.0.1 at >>>>> 2009-03-05 >>>>> 00:06:10) [POST] >>>>> Parameters: {"commit"=>"Incluir Propiedad", "property"=> >>>>> {"garage"=>"1", "purpose"=>"Venta", "front"=>"25", >>>>> "rent_price"=>"1300", "baths"=>"1", "contact"=>{"company"=>"La >>>>> cantera >>>>> del señor Rajuela", "cell"=>"0123456789", "phone"=>"0123456789", >>>>> "contact_type"=>"Propietario", "fax"=>"2255-14510", >>>>> "first_name"=>"Pedro", "last_name"=>"Picapiedra", >>>>> "email"=>"[email protected]"}, "image_attributes"=> >>>>> [{"photo"=>""}, {"photo"=>""}, {"photo"=>""}, {"photo"=>""}, >>>>> {"photo"=>""}, {"photo"=>""}, {"photo"=>""}], >>>>> "this_type"=>"House", >>>>> "description"=>"casa grande", "rooms"=>"1", "localization"=>"en >>>>> las >>>>> afueras", "exclusive"=>"0", "address"=>"100 norte del sur", >>>>> "lot_area"=>"1800", "const_area"=>"500", "province"=>"San Jose", >>>>> "sell_price"=>"500000", >>>>> "min_price >>>>> "= >> >>>>> "150000 >>>>> "},"authenticity_token >>>>> "=>"225a4b100cfce5efa6781ab2eabddc8b2d9690c7"} > > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

