If you know the states name, then you automatically know the capitals
name, dont you?
So then it wouldnt be necessary to submit the capital name as a hidden
field, as you can retrieve it through the state object.
Or am I missunderstanding something?

On Apr 19, 3:40 pm, Ze Ca <[email protected]> wrote:
> Colin Law wrote:
> > On 19 April 2010 08:10, Ze Ca <[email protected]> wrote:
> >> In my form I have a select menu for US States. I would like to include
> >> the capitals of those states as a hidden parameter when passed to the
> >> model. Of course, the capital should match the state chosen.
>
> > I don't understand exactly what you are trying to do, here you say you
> > want to pass this information to the model (did you mean controller).
> > What has this got to do with a hidden field on the form.
>
> >> I know I can set a attr_accessor :state_capitals in the model, or even
> >> make a migration to update the table and add the column, but I'm having
> >> some trouble creating this in the view. Is it ok for the view to have
> >> some logic in this case?
>
> > Again I am unclear where this information is coming from and what you
> > are trying to do with it.  Perhaps you could explain in a little more
> > detail what you are trying to accomplish.
>
> > Colin
>
> Colin,
>
> Thank you for your reply. Yes, passing the information to the controller
> is what I meant (sorry about that!). This is just a toy project where
> I'd like to use the extra parameters (based on what the user enters) to
> "spit out" more information in the view. For example, If the user choses
> New York as their state and clicks submit, the resulting "show" view
> shows the user other information about the state they chose from the
> selector list (such as the capital).
>
> Thanks!
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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