Displaying 20 results from an estimated 10000 matches similar to: "HABTM and collection_select"
2006 Apr 21
0
collection_select has_and_belongs_to_many update_attributes
I know there have been threads on this before but I was thinking
shouldn''t multiple collection_select automatically update habtm
relations when you update_attributes?
In order to get multiple collection_select to work I use:
collection_select(:user, :group_ids, Group.find(:all), :id,
:name,{},{:multiple=>'''',:name=>''group[id][]''})
In fact if I
2006 Jun 29
0
HABTM and select form helper
I am very confused about HABTM and a form select statement that I need to
implement.
I have two objects - Person which has the following fields:
id, firstname, lastname, email
Category which has the following fields:
id, name
A person HABTM categories and also the reverse. I have setup the join table
using a migration. All that went well.
Two questions - If I want to edit a person, how do I
2006 Mar 22
1
HABTM / Dropdown Help Needed
I''m terribly new to Rails, so bear with me.
I have an application I am working on which deals with projects and
subcontractors. There can be several subs on each project and each sub
can work on several projects. I have my join table set up and
has_and_belongs_to_many in both models. If I manually put data in the
join table, this works in my show view:
<% for subcontractor in
2011 Aug 11
17
f.collection_select: what are the parameters?
The rails docs are so horrible on the collection_select method. They
need to show a *complete* form, and show two examples: one that calls
f.collection_select(), and another that calls collection_select(), and
explain the differences.
Given this line:
f.collection_select :topic, Topic.all, :id, :category
What the !@#$!@#$ is :topic?
--
Posted via http://www.ruby-forum.com/.
--
You received
2006 Jul 17
0
collection_select help
I can''t figure out how to get the collection_select to correctly
identify and select the appropriate option in the drop down to begin
with. i have checked that charge.offense_level contains the correct
value to begin with (a number between 1 and 10) but the view still
defaults to the first option and not the one contained in the
charge.offense_level. what am i doing wrong? any
2007 Apr 20
0
problems returning collection_select info to controller
Hi,
I''ve been working with rails for a couple of months now and I''m
beginning to understand how things work but this has got me baffled.
I want to return the user.id from a selection of a list of user
names. I followed the example from AWD w/ Rails (page 487) on how to
use collection_select but the controller barfs because it wants a user
and the id is coming back as a string.
2006 May 11
1
ActiveRecord collection_select and has_and_belongs_to_many
Hello everyone, first post to the list and a relative newbie to Rails
development. Done quite a bit of JSP, PHP, HTML, XML etc and thought I would
kick the tires on Rails to see if it can speed up development for internal
applications. Anyway, I am running into a problem that is just driving me
crazy and everything I read on the net doesn''t seem to help. I was hoping
someone here might
2012 Sep 13
3
Creating a link_to from a collection_select
I want to be able to change one attribute of a link_to to be what is the
current selection of the collection_select. And needless to say I can''t
quite figure it out.
app/views/tasks/show.html.erb
Who would you like to assign this task to?<br />
<%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id,
:action =>
2006 Jun 07
10
habtm "AND" find conditions
I have two tables and a join table for them
e.g. books, authors in a many to many relationship (habtm) and a join
table books_authors.
I can successfully search for a book that has
"author.id = 2 OR author.id = 4"
but I am unable to search for
"author.id = 2 AND author.id = 4"
This is because the result of all the joins only has one author.id
column so no single row has
2006 Apr 27
3
collection_select to display 2 fields
I''m trying to get a collection_select generated Drop-down box to display
two fields from a table (first name & last name); however, I am having
trouble concatenating the symbols. It appears as though any code I put
in the 5th argument for collection_select is processed prior to
executing the collection_select method. The code executes successfully
with 1 symbol in the 5th
2008 Feb 20
0
HABTM problem
Hello,
I have two tables "people" and "relations"
Following are the models
class Person < ActiveRecord::Base
has_and_belongs_to_many :relations
class Relation < ActiveRecord::Base
has_and_belongs_to_many :people
I want to select multiple relations and when i say
Person.create(params[:person]) in controller
the relation ids and and id of person should be stored in
2006 May 24
0
Problems validating form with collection_select
I have the following models:
class Comandancia < ActiveRecord::Base
has_many :elementos
end
class Elemento < ActiveRecord::Base
belongs_to :comandancia
validates_presence_of :nombre, :apellido_paterno, :apellido_materno,
:comandancia
end
In the view for New Elemento I''m using
<%= start_form_tag :action => ''create'' %>
<%= render :partial =>
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 22
2
Setting an index on a collection_select
I am creating a data entry form that allows a user to fill in multiple rows
and save them all at once. In my controller, I create an array of "person"
objects and pass it to the page. On the page, I have a text field like so:
<%= text_field "person", "name", "index" => 1 %>
Note the "index" attribute, which sets the name and id
2010 Aug 30
1
update form text_field on collection_select selection
I have form and a collection_select control. I would like to update
form fields (text box) when I select an item from the collection_select
box.
It''s like selecting template from the collection_select and the template
automatically loads to text boxes.
Any help?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
2006 Aug 16
1
how to update a collection_select from another
I have two collection_select in my list.rhtml:
<%= collection_select (:region, :id, @regionall, :id,
:title,html_options={:onChange => "new
Ajax.Updater(''related_provinces'',''/categories/related_provinces/" +
"?id=''+this[this.selectedIndex].value,
{asynchronous:true, evalScripts:true});"}) %><br>
<%= render :partial =>
2006 Apr 25
1
simple collection_select problem.
Hi,
I can do this :
collection_select "state", :id, TrainingState.find_all,:id,:name
but not this :
collection_select "state[]", :id, TrainingState.find_all,:id,:name
Anyone any idea why? Is there something about collection_select that
does not allow collections?
Thanks
Chris
--
Posted via http://www.ruby-forum.com/.
2006 Jun 10
4
collection_select question
How do I specify which option should be initially selected when using
the collection_select command? I''ve tried:
collection_select(:selectionfilter, :producer_id, Producer.find(:all),
:id, :name, {:include_blank => true, :selected_value =>
@initial_selection})
However it doesn''t return the desired results (the option with the value
of @initial_selection selected).
2006 Jan 23
3
HABTM: Records with no parents
I have a habtm relationship between two models. What I want to do is
find items that aren''t related. So like if you had authors <->
posts, how would you find authors who don''t have any posts? Or posts
that don''t have an author ?
Thanks,
Alex Strand
[astrand@razorcom.com]
Razorcom
www.razorcom.com
2006 May 23
0
return value from collection_select
Hi everyone
I am trying to get the return value from collection_select helper
method. Here is what I did
collection_select(''product'', ''product_id'', @products, ''id'', ''name'', {},
{:onchange => remote_function(:url => {:action => :myFunction},
:with => "this[this.selectedIndex].value")})
then in my