Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Can't figure out Has_many in select form
- class Position < ActiveRecord::Base
- #position attributes
- has_many :educations, :foreign_key => "position_id"
- class Education < ActiveRecord::Base
- belongs_to :position
- EDUCATION_CHOICES = ([["Undergrad", "0"],["Master", 1],["PHD", 2]])
- <%= f.select(:education_ids, Education::EDUCATION_CHOICES,{ :prompt => "Please select"},
- { :multiple => true, :size => 5 }) %>
- <%= f.select(:education_ids, Education::EDUCATION_CHOICES,{ :prompt => "Please select"},
- { :multiple => true, :size => 5 }) %>
- @position = Position.new(params[:position])
- Processing by PositionsController#create as HTML
Add Comment
Please, Sign In to add comment