Displaying 9 results from an estimated 9 matches for "value_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/.
2012 Jan 24
4
:locals does not pass var in rails 3.1.0 partial view
...39;'standards'', :locals => { :f =>
f, :sid => r.id } %></p>
<% end %>
Here is the standards partial view:
<%= f.association :standards, :collection =>
Standard.active_std.all(:order => ''name''), :label_method
=> :name, :value_method => :id, :prompt => "Choose std", :label =>
"standard:", :include_blank => true, :selected => sid %>
When standards rendered, there is an error saying that var or method
not defined. Any thoughts about the problem? thanks.
--
You received this message becaus...
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 Mar 25
0
in_place_collection_editor
...method, self)
+ 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_con...
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 bet...
2005 Jul 06
1
collection_select not selecting the selected item
...alues are selected, 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...
2014 Apr 19
0
How to has_one/belongs_to association only return the objects unassociated in combobox?
...els (Car and Driver) and a combobox to select which driver
belongs to which car. I want the combobox just show the objects that have
not yet been associated.
# vehicle belongs_to: driver
# driver has_one: vehicle
# simple_form # vehicle/_form.html.haml
= f.association: driver, label_method: :name, value_method: :id
How to ensure validation before saving, to avoid problems of concurrent
accesses?
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ru...
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
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