similar to: options_for_select.

Displaying 20 results from an estimated 5000 matches similar to: "options_for_select."

2007 May 11
5
options_for_select - how to set the selected value?
Ok, this should be simple but I am finding it''s not and previous postings don''t seem to shed too much light on this. I have a select_tag with 4 values pulled in via a helper: def filter_hours filter_hours = [ ["1 hour", 1], ["24 hours", 24], ["7 days", 168], ["14 days", 336], ] end The select_tag looks
2011 May 28
4
how can I investigate when a rspec test fails?
For example: it "re-renders the ''new'' template" do # Trigger the behavior that occurs when invalid params are submitted Sector.any_instance.stub(:save).and_return(false) post :create, :sector => {} response.should render_template("new") end I have the new template under app/views/sectors but the test says: SectorsController POST
2007 May 24
3
Help with Create and Update with options_for_select in a select_tag
I have a select_tag in my view that uses options_for_select with multiple = true. I am having trouble figuring out the Rails way to create and update that field. Please help. Models: ------------- Service has_many AccessControl AccessControl belongs_to Service application.rb ------------------------- $types = Array["Athens", "htpasswd", "IP", "None",
2006 Jul 04
1
options_for_select - default nil value
I have a field in a view, like so: <%= select_tag(''quoted_condition'', options_for_select([''NEW'',''RETAIL'',''OEM'',''REFURB''], ''NEW'')) %> This sets the ''selected'' value to ''NEW'' - however, I would like to have a nil value here, so I can
2008 Jan 03
1
Help using options_for_select in select_tag
<b>Client</b><br /> <%= select_tag ''clients[]'', options_for_select( [['' '',''1''], [''aaaa'',''2''],
2011 Jun 12
2
when new rails releases.......
What do you do? A new release can break an application build on a preceding release and often an application needs to modify. So what to do? Fix the rails version in the Gemfile? In this manner I''ll have a lot of rails versions in the disk. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send
2010 Oct 01
8
field_with_errors.
If a model doesn''t pass validation the field in the view is put under a <div class="field_with_errors">. But who create that div? field_text helper do it? -- 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
2008 Jul 20
1
selected attribute in options_for_select
Hello Everyone I have a select_tag which I populate using a map, I use options_for_select method to pass the map and "selected" value. For some reason I can not get the option "selected" based on the value I pass to the selected attribute. Here is the code <%= select_tag :current_course, options_for_select( Course.find(:all).map {|p| [p.title,p.id]}, @selected )
2007 May 24
1
How do I show the selected values in options_for_select? Not as simple as it sounds.
How do I show the selected values in options_for_select? I have a Service model and a AccessControl model. When a user edits a Service I want the services access_controls to be pre-selected. Models: Service has_many AccessControls AccessControl belongs_to Service application.rb: $types = Array["Athens", "htpasswd", "IP", "None", "Other",
2008 Jan 22
1
getting multiple select to work: options_for_select
Hi, <%= select_tag ''image_id'', options_for_select(Image.find(:all) {| an_image| [ an_image.name, an_image.id ] }), :multiple => true %></p> * I am in a view, and I am trying to search the image table and make a multiple select box with each image''s name. * Right now it is working, but I see this: ---------------------------------------------
2006 Jul 13
2
Simple dropdown menu
Hi, I''m quite new to this language and I''m having trouble finding out simple things like a dropdown menu in rhtml. I know I have to use <% select_tag %> but I''ve read lots of different ways to put in the options so I''m a bit confused. Options are hard-coded for the menu I''m trying to create so no database is involved! Thanks v much! Bex --
2006 Feb 02
8
How to get all selected rows in the mutli-selection listbox?
Hi, I have created a multiple selection listbox with rails, when I try to get the rows selected by user, rails send back only the first one, how can I get the other selected rows???? I created the listbox with the following function: select_tag("form__list1", options_for_select(["A","B","C","D"], selected = "A"), html_options =
2010 Dec 25
6
undefined local variable or method?
I have: <%= form_for(@supplier) do |f| %> ....... ...... <%= render ''sector_categories'', :locals => {:f => f} %> in _sector_categories partial I have: <div class="field"> <div id="category_update"> <% for category in @categories %> <%= f.check_box :category_ids[], category.id,
2012 Nov 26
8
why functional test does not get failure?
The test: test "should get new" do get :new, :room_id => @room.name assert_template(:ne) end the template new does not exists but the test does not get failure. Why? -- 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
2011 Jun 15
5
rails 3.0.9
Today was expected the new stable rails release 3.0.9 with some fixed, among all the problem with escape_javascript. It seems that it see that has not been released, unfortunately. -- 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
2012 May 10
6
Is it suitable using STI?
I have problems on a simple design problem. I have many companies. Each company have one or more commercial activity. Activities types are: ecommerce, local unit, television, automatic vending machines, and so on. Company may have one or more ecommerce activity or one or more local unit activity, one ormore vending machines, etc. How can I model this scenario? Company has_many ecommerce has_many
2007 Jan 25
2
React on select_tag (onchange)
Hi, I''m new in developint rails (but I love rails). I would like to react on changing a field in the view (no model field) from a selection box to show the number of rows (which I used in the controller). In the controller I read the params-hash: ... @rowsperpage = params[''rowsperpage''].to_i ... In the view I have the field, where I like to react directly. ...
2006 Apr 11
5
multiple select_tag
Hello again, I have a table called line_items, with the following fields: id int item_name varchar() qty int conditions text I''ve made my LineItem model, and everything works as such (with simple text_fields).. Now I''d like for the conditions field to be a select_tag() with multiple choice possibility. I''m guessing I need some code to expand/restract the array for
2010 Mar 22
7
How to reference a select_tag within a form
Hi All, Inside my app\views\expenses\new.html.erb file, I had the code: <% form_for(@expense) do |f| %> [snip] <p> <%= f.label :vendor %><br /> <%= f.text_field :vendor %> <br /> <div id="vendor_droplist> <%= select_tag "test", options_for_select(@current_vendors.collect { |v| v.nickname }), {:multiple
2011 Jun 19
10
validates_numercality_of with allow_nil.
In the model I have: validates :square_meters_public_land, :barrier_meters, :numericality => { :greater_than_or_equal_to => 0 }, :allow_nil => true but if, in the field, on create, I don''t insert a value I have the error "field is not a number". -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To