On 27 Oct 2008, at 22:44, Lawrence Lu wrote:

>
> I'm creating a practice app on RoR, but i've run into this problem and
> I'm not sure how to proceed.  Basically, its a stock picker, and there
> are Portfolios, Stocks, and Holdings.   Holdings belong to both
> Portfolios and a particular Stock.
>
> In my "create holding" page, i'm allowing the user to provide a Stock
> symbol (a string column in the stock table) and a quanity.  However,
> for obvious reasons this doesnt work as when the form is submitted,
> this line:
>
> @holding = Holding.new(params[:holding])

> Expects the value of "stock" that is passed in to be an actual Stock
> object, not a string representing the symbol for that stock.
>
change params[:holding][:stock] before you pass it to Holding.new

Fred


> How exactly should I get around this without converting the Stock
> field to a dropdown?
>
> Thanks!
>
> >


--~--~---------~--~----~------------~-------~--~----~
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