ruby on rails - select_tag, problems with the record in the database -


there 2 tables heading , beautysalon. in first table write name of beauty salons , second services provide. table beautysalon heading field associated head , idea there recorded id lounge tables heading, why there not writing.

  <%= select_tag 'beautysalon[head]', options_for_select(@hea.collect{ |s| [s.name, s.id] } ) %> 
it's model heading
 class heading < activerecord::base   belongs_to :section   has_many :beautysalons   searchable     text :name     text :address     text :phone   end end 
, model beautysalon
 class beautysalon < activerecord::base   belongs_to :heading end 
beauty salon shema
  create_table "beautysalons", force: true |t|     t.string   "services"     t.datetime "created_at"     t.datetime "updated_at"     t.integer  "heading_id"     t.integer  "head"   end 
heading shema
  create_table "headings", force: true |t|     t.string   "name"     t.string   "address"     t.integer  "phone"     t.integer  "sec"     t.datetime "created_at"     t.datetime "updated_at"     t.integer  "section_id"   end 


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -