EduardoChinchilla
2009-Mar-05 14:31 UTC
ArgumentError (wrong number of arguments (1 for 0)):
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
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"=>"ppicapiedra-xlenG6deKZTY0TyS/+Ba5Q@public.gmane.org"},
"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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-05 14:59 UTC
Re: ArgumentError (wrong number of arguments (1 for 0)):
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"=>"ppicapiedra-xlenG6deKZTY0TyS/+Ba5Q@public.gmane.org"}, "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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
EduardoChinchilla
2009-Mar-05 16:50 UTC
Re: ArgumentError (wrong number of arguments (1 for 0)):
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? On Mar 5, 8:59 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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"=>"ppicapie...-xlenG6deKZTY0TyS/+Ba5Q@public.gmane.org"}, "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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-05 17:48 UTC
Re: ArgumentError (wrong number of arguments (1 for 0)):
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 <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > 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"=>"ppicapie...-xlenG6deKZTY0TyS/+Ba5Q@public.gmane.org"}, "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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
EduardoChinchilla
2009-Mar-05 19:36 UTC
Re: ArgumentError (wrong number of arguments (1 for 0)):
Thanks Frederick I really appreciate your continued support through
this list.
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
<frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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
<frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > 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"=>"ppicapie...-xlenG6deKZTY0TyS/+Ba5Q@public.gmane.org"},
"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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Did you pick a method name that Rails is already using by any chance? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
EduardoChinchilla
2009-Mar-05 21:43 UTC
Re: ArgumentError (wrong number of arguments (1 for 0)):
khiltd: Well I think that´s a possibility, but how could I check that? On Mar 5, 1:51 pm, khiltd <khilt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Did you pick a method name that Rails is already using by any chance?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-05 21:48 UTC
Re: ArgumentError (wrong number of arguments (1 for 0)):
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 <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > 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 <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> 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"=>"ppicapie...-xlenG6deKZTY0TyS/+Ba5Q@public.gmane.org"}, "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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
EduardoChinchilla
2009-Mar-07 05:14 UTC
Re: ArgumentError (wrong number of arguments (1 for 0)):
Ok. Solved The problem was that I put a white space between params and the brackets as: params [:property] instead of params[:property]. Thanks Fred and khiltd. On 5 mar, 15:48, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > 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 <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >>> 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"=>"ppicapie...-xlenG6deKZTY0TyS/+Ba5Q@public.gmane.org"}, "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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---