I have a simple situation. There are two tables:
states
id int
locators
state_id int
Obviously, state_id is a foreign key. I have created the models using
script/generate and updated them with has_many and belongs_to. Now I
build a form with a select box with all of the state names and ids.
When I create the locator, I try:
locator = Locator.new()
locator.state_id = params[:stateid]
Now ruby complains that there is no state_id attribute. There is an
attribute "state" but it wants a whole state object, which I guess I
could create, but it seems silly. I suspect it it more likely that I am
doing something wrong. Can someone who actually knows what they are
doing tell me what it is? Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---