jquery - Is there a way to extract ID from autocomplete in Rails 3.2 app? -
jquery - Is there a way to extract ID from autocomplete in Rails 3.2 app? -
the autocomplete implemented in bom
model works fine. here autocomplete related code in bom
model:
belongs_to :part, :class_name => billofbasematerialx.part_class.to_s def part_name_autocomplete self.part.try(:name) end def part_name_autocomplete=(name) self.part = billofbasematerialx.part_class.find_by_name(name) if name.present? end
after user selects part name
generated autocomplete
, save part id
@part_id in controller , pass @part_id views farther processing. other part name
in params[:bom][:part_name_autocomplete]
, did not find object @part
or related part id
. can still retrieve part
object name, prefer have part id
instead. there way retrieve part id
after autocomplete?
jquery ruby-on-rails autocomplete
Comments
Post a Comment