Somewhat new to rails and trying to build something to learn, but having an issue.
I have successfully created one form field that reads from a collection of categories. I generated scaffolding for the categories and two fields catId and name. After plugging in the field everything worked perfectly.
I have tried to replicate this with a different name now (zipCode), but am getting an error saying an undefined method of zipCode when trying to save the event (the form that is being filled out). I'm not understanding why this isn't working as easily as the categories did. I have set up the relationships and the attributes are accessible.
Here is some code.
From the event form:
<%= f.collection_select(:catId, Category.all, :catId, :name) %> <%= f.collection_select(:zip_id, Zip.all, :zip_id, :zipCode) %>
The zip model:
class Zip < ActiveRecord::Base attr_accessible :zipCode, :zip_id belongs_to :event end
The event model:
class Event < ActiveRecord::Base attr_accessible :catId, :name, :zipCode, :zip_id has_many :categories has_many :zips end