Thanks for the quick reply Billy. Sorry, I should've explained it 
clearer.

Basically, I'm trying to add items (along with the item's user-inputted 
attributes) to a cart. I'm using this in my controller:

@cart.add_item(product, params[:quantity], params[:description], 
params[:color], params[:size])

Now, in my model, I want something like this:

def add_item(product, quantity, description, color, size)
 ...
end

That's correct, but I'm finding it tedious to constantly paste the 
"product, quantity, description, color, size" a bunch of times 
throughout my app. It's somewhat time-consuming, but I think even more 
important, it's inflexible (e.g., if I want to change or add one 
attribute in the future).

So, my main goal is to convert this:

def add_item(product, quantity, description, color, size)
 ...
end

to this:

def add_item(product_attributes)
 ...
end

while still being able to use the add_item function:

@cart.add_item(product, params[:quantity], params[:description], 
params[:color], params[:size])

What do you think? (Am I approaching this the wrong way?)
-- 
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 [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