Wednesday, 15 August 2012

ruby on rails - populate dropdown from a column of a table in RoR -



ruby on rails - populate dropdown from a column of a table in RoR -

in ruby on rails application want create dropdown populates column of table:

having table: id | openings | location 1 | developer | abc 2 | engineer | mno

and want populate dropdown openings table: , below

<div class="opening1"> <%= select :select_opening, options_from_collection_for_select(@openings,"id","openings"), {}, :id => "ddl_openings", :style => "margin-top: 10px" %> </div>

but getting error below:

wrong number of arguments (4 3)

below controller page:

class staticpagescontroller < applicationcontroller def new @openings = opening.all end def openings @getopening = opening.select('"openingtitle", "openinglocation", "openingdescription"' ) end def viewresume @openings = opening.all end end end

and @ line @openings = opening.all columns of opening table , want values of openingtitle column of table populating dropdown. kindly help me, waiting reply. thanks.

ruby-on-rails

No comments:

Post a Comment