search for: text_method

Displaying 9 results from an estimated 9 matches for "text_method".

Did you mean: test_method
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 Mar 25
0
in_place_collection_editor
...tag_options = {:tag => "span", :id => "#{object}_#{method}_#{tag.object.id}_in_place_editor", :class => "in_place_editor_field"}.merge!(tag_options) + in_place_collection_editor_options[:collection] = collection # .collect {|c| [c[value_method],c[text_method]]} + in_place_collection_editor_options[:value] = tag.object.send(method) + in_place_collection_editor_options[:url] = in_place_collection_editor_options[:url] || url_for({ :action => "set_#{object}_#{method}", :id => tag.object.id }) + tag.to_content_tag(tag_op...
2006 Mar 07
6
how to add onchange javascript event to select field
I would like to add javascript ''onChange'' event handling for a select field, such as <%= collection_select("job", "client_id" , @clients, "id", "name") %> with onChange="xxx" Anyone know how to make this work? Thank you, Scott -- Posted via http://www.ruby-forum.com/.
2006 Jun 09
0
options vs. html options in collection_select
I wanting to add an onchange event handler to collection_select but I''m not sure how. The api gives the signature as collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {}) I''m not sure, however, if I need to place the desired code in "options" or "html_options". I''m sure I could just figure it out through trial and error, but is there some resource which explains the difference between options...
2005 Jul 06
1
collection_select not selecting the selected item
...cted, even there is a selection (7, to be exact). So, I dug up in the Rails code, and I found ActionView::Helpers::InstanceTag#to_collection_select_tag. Except line 4 of this method is: "select", add_blank_option( options_from_collection_for_select( collection, value_method, text_method, value), options[:include_blank]), html_options [split for readability; looking at r1739, line 306: http://dev.rubyonrails.org/svn/rails/trunk/actionpack/lib/action_view/helpers/form_options_helper.rb] I''m wondering where the "value" item is coming from... If I remember co...
2006 Nov 26
0
concatenate fields in collection_select
...e model reference inside the option value with the description of this model reference. I''ve tried : <%= collection_select(:assets, :model_id, @models, :id, {:model_ref :description}, :prompt => ''- Select a model -'') %></p> But it doesn''t work, the text_method of collection_select doesn''t seams to support two columns. Any idea I can do that ? 2) The ":prompt =>''-Select a model-''" doesn''t work. I''ve tried as the rails API suggest "options={:prompt => ''- Select a model -'...
2006 Apr 24
4
creating a select box
Hi trying to create a select box in _form.rhtml. I have a table called organisations that contains fileds, 2 being ''id'' and ''name'' these are the fields I need to bring over to the clients _form.rhtml. whats the best way of going about that?? 2 ways i have seen suggested that I cant get to work -@organisations = Organisation.find_all placed this in def new
2008 Feb 05
5
how can my model reference a helper?
I know, I know, they''re not allowed to. But here''s my problem. I''ve got a really simple model with two fields, name and price, which I want to show in a form select drop-down. "collection_select" takes a ''text_method'' parameter, which is the method in the model that gets its value placed in the <option> tag. Because I want to show both name and price, I had to add an extra method in my model- def description "#{name} - #{number_to_currency(price)}" end But this fails, because now I...
2010 Jul 16
31
Added associations but don't see generated methods
Hi, I''ve got a Rails app working that includes two two classes, etc.: Expense & Vendor. I eventually learned that the mental concept I had of their relationship should be express in Rails as: class Expense < ActiveRecord::Base; belongs_to :vendor; end class Vendor < ActiveRecord::Base; has_many :expenses; end