search for: options_from_collection_for_select

Displaying 20 results from an estimated 113 matches for "options_from_collection_for_select".

2007 Nov 08
3
options_from_collection_for_select
I need to add a blank or dashed field to the options_from_collection_for_select helper but can''t seem to get it to work. Tried this, but with no effect: <%= options_from_collection_for_select @airlines, ''id'', ''name''], {:include_blank=>true} %> Anyone know how to do this? Thanks, -S -- Posted via http://www.ruby-forum.co...
2006 Jul 30
2
options_from_collection_for_select & multiple columns
I have a table with first_name and last_name, and wan''t to populate a drop-down with the id and the person''s name consisting of the first and last names concatenated together. Can''t figure out how to tell options_from_collection_for_select to do that. Any ideas? I basically need to do something like: <%= options_from_collection_for_select @media_creators, "id", "last_name + '' '' + first_name", @media.media_creator_id %> media belongs_to media_creator media_creator has_many media Thank...
2008 Apr 02
4
options_from_collection_for_select
I have a drop down of country''s and I would like the USA to be the first displayed. I have tried: <select id = "user_w_country" name ="user[w_country]" onchange = "<%=func%>"> <%= options_from_collection_for_select @country, ''id'', ''country'', :selected => Countrycode.find_by_country(''USA'').id %> </select> It doesn''t complai9n about the code but it doesn''t work either. The documentation for the options_from_collection_for_se...
2008 Jun 08
1
Unable to get selected option with options_from_collection_for_select
I''m in Rails 2.1, Ruby 1.8.6 -- http://pastie.org/211063 <%= params[:doctor_id] %> <%= options_from_collection_for_select(Doctor.active, :id, :name, :selected => params[:doctor_id]) %> <%= options_from_collection_for_select(Doctor.active, :id, :name, :selected_value => params[:doctor_id]) %> Returns: 53 <option value="49">Michael Summer</option> <option value="52"&g...
2006 Apr 04
1
habtm and options_from_collection_for_select [1.0.0]
I ran into a problem using options_from_collection_for_select : ActiveRecord::AssociationTypeMismatch (Topic expected, got String): /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/associations/association_collection.rb:128:in `raise_on_type_mismatch'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ ac...
2008 Jul 31
2
selected value for options_from_collection_for_select
Hey, I am trying to get a select list with a selected value in it. Even if I put in an integer, like this, <%= select_tag(fruit.id, "<option>No Contract</option>" + options_from_collection_for_select(@fruit_types, "id", "kind", 3)) %> the list still displays the first option (No Contract) in the list. What am I doing wrong? I''ve looked all over and it looks like this should be working. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~-------...
2006 Jan 03
1
options_from_collection_for_select - NIL Object
i am kind of desparated i try with options_from_collection_for_select to get option values, but it says You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.inject but @customers is not empty -> def get_customer @customers=Customer.find_all end i have tested it and also...
2005 Dec 19
0
Pre-selecting options_from_collection_for_select Options
I''m trying to use options_from_collection_for_select to generate options for a multiple select: <select id="metro_area_states" name="states[]" size="10" multiple="multiple"> <%= options_from_collection_for_select State.find(:all), :id, :name, @metro_area.states %> </select> When selecti...
2006 Jun 28
6
select_tag
in my controller @cursos = Curso.find_all in my view i''m trying to do a select_tag with the results @cursos, using a helper select_tag "name" options_for_select(@cursos) --------> not works select_tag "name" @cursos --------> not works how to do it, using the helper? tks -- Posted via http://www.ruby-forum.com/.
2006 Jan 08
1
Options_from_collection_for_select -> Multiple fields in display
The following code shows a list of the users, with username being each person''s initials (mine would be DM). &lt;%= options_from_collection_for_select @users,"id","username" %&gt; However, I''d like to have the display of the SELECT box be "DM - Dylan Markow" instead of "DM." Is this possible using options_from_collection_for_select, or will I need to manually loop through the entries myself?...
2008 Jul 31
1
Stuck on options_from_collection_for_select
Hi everyone, I''m stuck on something that seems to be super easy, but maybe I''m just too tired to see the obvious answer. I''m trying to make a drop down with select_tag and options_from_collection_for_select. I''m trying to fill this drop down list with different human races (white, black, hispanic, etc. in the database under the name field, with a unique id for each) in the index page of lost_children. I have two models: lost_children.rb [code] belongs_to :race [/code] race.rb [code] has_...
2013 Jan 18
2
options_from_collection_for_select
I have just started using RoR and am creating some select boxes on my form with the following code: <%= select_tag(options_from_collection_for_select(Owner.all, :id, :fname)) %> My problem is that it does NOT return the first record from the table, but just the second and succeeding records. Does anyone have any ideas on how I can get the first record included in the select box? Thanks. -- You received this message because you are subscr...
2005 Dec 22
7
Ruby on Rails and lookup tables
Hi, I''m a newbie on both Ruby and Ruby on Rails, and I''m struggling with my first app. I have a table with a column called "employee_id" which is a foreing key associating it with the "employees" table. I have populated both tables. When I run "ruby script/generate scaffold <model name> <controller>" it generates a web page with all
2005 Dec 01
0
problem with options_from_collection_for_select() need id not name
...24, Oostende (Gevens)</option> <option value="11">Rederskaai 39, Zeebrugge (VME Complex Foster)</option> </select> but no id tag i can work with this, here i got an id and the submit works <select id="geotag_id" name="geotag_id"> <%= options_from_collection_for_select(@geotags, "id", "address1") %> </select> but i also need address2 and floor, and this seems not to work <select id="geotag_id" name="geotag_id"> <%= options_from_collection_for_select(@geotags, "id", "address1" + "...
2009 Apr 30
0
Trunicating Names in options_from_collection_for_select
Anyone know how I could trunicate the names of a passed in array in options_from_collection_for_select? I tried a few things but nothing worked. Any ideas would be appreciated! <%= options_from_collection_for_select available_projects, :id, :name, @selected_project_id %> -- Posted via http://www.ruby-forum.com/.
2006 Jul 02
0
Problem with select, options_from_collection_for_select for selected items
I''m having problems to make the selected works, i''ve been trying with select and options_from_collection_for_select. I''ve tried, :selected, :selected_key, :selected_value, and all i can got from the doc page ( http://rubyonrails.org/api/classes/ActionView/Helpers/FormOptionsHelper.html#M000399 ) and from wiki. Code: select(''informacao'', ''tipo_analise_id'', options, :se...
2006 Jun 20
0
options_from_collection_for_select question
...elect categories for a recipe, I have a select control. When editing, I want the proper categories selected. In order to get it to work, I put this in my _form.rhtml: <select id="recipe_categories" name="recipe[category_ids][]" size="4" multiple> <%= options_from_collection_for_select( @categories, ''id'', ''name'', @recipe.categories.map{|t| t.id}) %> </select> Is this the best way to do this? ~S
2006 Sep 09
1
options_from_collection_for_select
I''ve looked at the API on this but can''t quite see what I''m missing from my call <select id="pay[pay_id] name="pay[pay_id]"> <%= options_from_collection_for_select( Pay.find_all_by_name, "id", "name") %> #<- line 5 </select> is returning - Showing app/views/kr/index.rhtml where line #5 raised: wrong number of bind variables (0 for 1) in: pays.`name` IS ? Anyone ? TIA Stuart --~--~---------~--~----~------------~-------~...
2007 May 15
0
options_from_collection_for_select Question
Is there a way to sort the sql result set that populates the options_from_collection_for_select?? Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@...
2006 Oct 11
2
Help please with observe_form - not working
...gt; "livesearch"}, :id => "asearch") %> <div id="parta"> <fieldset><legend>Category</legend> <select name="cat", @params[''cat''][],size="2" multiple="multiple"><%= options_from_collection_for_select @categories, :id, :name %></select></fieldset> <fieldset><legend>State</legend> <select name="stat", @params[''stat''][],size="5" multiple="multiple"><%= options_from_collection_for_select @states, :id, :name %...