def add_item(×product_attributes)
  product, quantity, description, color, size = ×product_attributes
end

then

add_time(product, quantity, description, color, size)

On Dec 11, 1:28 pm, Bob Sanders <[email protected]>
wrote:
> I see that I'm repeating a lot of code throughout my app, and I wanted
> to do something like this in my model:
>
> def product_attributes
>  [product, quantity, description, color, size]
> end
>
> def add_item(product_attributes)
>  ...
> end
>
> ...but that of course isn't working. (I'm getting a "wrong number of
> arguments (5 for 1)" error)
>
> Is there a way to pass those product attributes into the add_item
> function properly? Or, maybe you know of a different way I should I
> approach this?
> --
> Posted viahttp://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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to