similar to: collection_select not selecting the selected item

Displaying 20 results from an estimated 300 matches similar to: "collection_select not selecting the selected item"

2006 Mar 25
0
in_place_collection_editor
Hi, I''m trying to write a helper for Scriptaculous'' InPlaceCollectionEditor component. I''ve already submitted a patch (http://dev.rubyonrails.org/ticket/4302). This was a drunk patch; it needs a bit of work (Don''t drink & code!). So far I''ve gotten it to work correctly with normal collections, but I want to use it for belongs_to relations as
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
2005 Jun 13
3
validations not working with collection population droplists
I have an ADD form with foreign key field values selectable via select list ( collection_select (...)). When I add validates_presence_of :someotherfield to my model for error trapping, I get the following error for each droplist: NoMethodError in Reviews#create_curriculum Showing /reviews/_form.rhtml where line #16 raised: undefined method `inject'' for nil:NilClass Extracted source
2010 Jun 24
0
Nested Model Forms
I''m trying to get a multi level nested form model working but have hit a problem. In one of my models, I have a habtm association and it''s throwing an error on a nested form and these are check boxes with a method of ''time_unit_ids[]''. The nested forms work without the habtm (time_unit_ids[]) so things are pretty much set up okay. Here''s the set up
2006 Nov 26
0
concatenate fields in collection_select
Hi, I am filling a collection_select with a list of models references based on a column named "model_ref". <%= collection_select(:assets, :model_id, @models, :id, :model_ref,:prompt => ''- Select a model -'') %></p> I have two issues : 1) I would like to concatenate another column next to the model reference inside the option value with the description
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 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/.
2012 Jan 24
4
:locals does not pass var in rails 3.1.0 partial view
Here is code in form.html.erb for partial view. Local var :sid was defined as the id of the record and it should be passed into the partial view standards.html.erb as a local var. <% @rfq.standards.each do |r| %> <p><%= render :partial => ''standards'', :locals => { :f => f, :sid => r.id } %></p> <% end %> Here is the
2006 Nov 23
1
Select Tag not working in 1.2rc1
I''m getting the following error message under rc1: ActionView::TemplateError (wrong number of arguments (1 for 0)) on line #54 of app/views/admin/admin_index.rhtml: In my view (* = Line 54): <%=start_form_tag(:action=>"sales_by_author")%> *<%=select("author","id",@authors.collect {|a| [a.name,a.id]})%> <%=submit_tag("Go")%>
2007 Jul 17
5
habtm confusion
Hello friends! I am trying to make a database that will have a group of people set to committees, and a person can be in multiple committees, and a committee obviously has multiple people. The people are senators at my university. These are my current models: senator.rb: -- class Senator < ActiveRecord::Base validates_presence_of :first_name, :last_name, :floor has_and_belongs_to_many
2014 Apr 19
0
How to has_one/belongs_to association only return the objects unassociated in combobox?
I have two models (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
2005 May 30
2
Testing action mailer in functional tests - missing section in the book
Hi ! I just need a pointer on how to do functional testing of ActionMailer. My unit test for the ActionMailer is working fine - now I simply need to assert that it''s being called in my Controller. The testing book ends quite abruptly at http://manuals.rubyonrails.com/read/chapter/64 I searched around on the web, but I didn''t find anything very conclusive. Thanks, François
2007 Dec 07
4
strange error on mock proxy
I''m banging my head over this really strange error in a view test when I run "rake spec". The weird thing is that I don''t get the error when I run the spec file by itself. Here is the spec (I know, fixtures are the devil): describe "/units/new.html.erb here" do fixtures :units, :accounts, :groups it_should_behave_like
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
2005 Nov 15
2
FormOptionsHelper select call failing
In Rails 0.14.3, I''m doing the following in a view: <%= select ''folder'', ''format'', [''a'', ''b'', ''c''] %> This line in is failing with: ActionView::TemplateError (too few arguments.) Am I calling select incorrectly? (Yes, the @folder object does exist, and does have an attribute
2005 Sep 14
4
How to drag/drop visitable anchors ?
Hi ! I have the following: <li id="photo_<%= @photo.id %>" class="photo"> <%= link_to(image_tag(url_for_file_column(:photo, :picture)), {:action => ''photo'', :id => @photo}, {:title => @photo.description}) %> </li> <script type="text/javascript" language="JavaScript"><!--
2007 Apr 30
1
collection_select - prepending a "any" option
Say I have a normal <SELECT> tag being generated thusly: <%= collection_select :task, :id, Task.find(:all), :id, :name %> what is the easiest way to add a "ANY" option to the top of the option list? I know Task.find(:all) returns a collection object, so is there a unshift() for that? well OK I tried: Task.find(:all).unshift([:id=>0,
2006 May 30
0
Problems when applying search to filter rows.
Hello, I am trying to create in the main Layout of the application fields of selection of fields of the model, and other to insert its value. Next I put a search button, with the idea to leak by the search in the view of the model where it executes this button. I have generated the views with ajaxscaffold. I do not know if what I try to do it does of this form or another one. My code is the
2005 May 23
1
has_and_belongs_to_many dual insert error ?
Hi ! (See references at the end) I have a slight problem. Whenever I save one of my domain models, which contains an has_and_belongs_to_many relationship with another one, the relationships are doubled. My domain is a series of pictures, where each picture can be tagged with one or more words. So, a picture of my dog could be tagged "Jordy, Dog, Dog 2005", for example. In my
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