Ruby on Rails
Tuesday, February 1, 2011
Hey there Amador,
I must confess, I am not a rails guru here but, according to the documentation I have, the part that reads
<%= f.select('entry', 'type_id', EntryType.all.collect {|t| [t.description, t.id]}, {:include_blanks => 'None'}) %>
should end with a { :include_blanks => false } not with a 'None' string value.
The other thing here is, if an annotation of your models look something like this:
Then in my understanding rails make the relationship between the two models if you have a field name containing the name of the table you want link to followed by an underscore and the name of the primary key of the referred table: i.e. enty model needs an entity_type_id field not type_id.
Well I guess that all I can see from what you have provided but like I said I am not an expert and I stand to be corrected. Hope this helps
Regards,
Tsega
-- The other thing here is, if an annotation of your models look something like this:
# Table name: entities
#
# id :integer not null, primary key
# type_id :integer
.
.
.
# created_at :datetime
# updated_at :datetime
# Table name: entity_types
#
# id :integer not null, primary key
# type :string(255)
.
.
.
# created_at :datetime
# updated_at :datetime
Then in my understanding rails make the relationship between the two models if you have a field name containing the name of the table you want link to followed by an underscore and the name of the primary key of the referred table: i.e. enty model needs an entity_type_id field not type_id.
Well I guess that all I can see from what you have provided but like I said I am not an expert and I stand to be corrected. Hope this helps
Regards,
Tsega
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment