Displaying 20 results from an estimated 4000 matches similar to: "problems returning collection_select info to controller"
2006 Feb 24
4
Problem having two belongs_to of the same class type
I have a Shipment class that is used to ship packages between Branches.
However, when I try to have two belongs_to in Shipment called shipped_to
and shipped_from I can''t seem to make it work. I can get it to display
the form properly but when I select the branches and click save I get
the following error...
"Branch expected, got String"
Any ideas? I have added some code
2007 Mar 20
2
collection_select - why doesn't it work?
Hi all
I guess this is quite a newbie question, but I''m just stuck here and
don''t know why.
<%= form.collection_select :origin_country, Country.find(:all), :id,
:name %>
gives me a select list with name="member[origin_country]". When
submitting the form the following error is shown:
Country expected, got String
When I try
<%= form.collection_select
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
2006 Aug 12
0
issues with relationships and multiple objects on one form
Hello,
1. I have a form that edits a User and a Person at the same time. The
controller is for the User. Everything works fine, except the fields
that are populated by the Person fields lose state when validation
fails. Do I use params to populate the user? I have tried a bunch of
combinations with no luck.
2. The same users table has an integer column called
2006 Apr 20
0
collection_select returning multiple values
Hey,
Is is possible to make collection_select return multiple values? If yes, how
can it be done?
I?ve tried:
<%= collection_select("group[]", "id", @groups, "id", "name", {},{:multiple
=> true}) %>
Leading to:
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error
2006 Mar 15
1
Through method problems with custom foreign_keys
A person has a many company_branches and
A company_branch has many people.
This join is represented using a "contacts" table.
I am using a legacy schema so i am forced into using non-standard rails
primary keys. I am using the new through relationship in rails 1.1.
p=Person.find(1)
b=p.company_branches # gives this error:
ActiveRecord::StatementInvalid: OCIError: ORA-00904:
2006 Mar 31
3
Complex Through Statement
Quick Overview:
I have an ''Employee'', some ''Merchants'' and some ''Products''. A
''Merchant'' has many ''Products''. An ''Employee'' has multiple ''Merchants'',
depending on their relationship. For example, the Employee may be the
enrollment contact for one merchant and the
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
2009 Apr 16
0
Magic multi connections with association problem
Dear all
I am using magic multi connections, there is some problem when using
association. How can I dynamic determine the module name (i.e.
A::Request, B::Request) in activerecord association.
Below is my code:
module A
establish_connection :A
end
module B
establish_connection :B
end
# and many module....
class Request < ActiveRecord::Base
set_table_name "request"
2006 Mar 29
3
Self-referential many-many joins with :through
I thought I had this nailed but.. now I''m seeing spots..
I''ve included my models below, feel free to ignore them. I''m really
just after an example that works. I couldnt find one on the wiki...
which is fair enough considering Ricks patch:
http://dev.rubyonrails.org/changeset/4022 that fixed them only went
through 5 days ago..
Cheers
-henster
2006 Jun 14
0
Mssql Multiple Database Access Error
Hi All,
I am having a problem to access multiple databases with mssql
I am running Ruby 1.8.4 and Rails 1.1 on Windows 2000 Advanced Server.
I am simply trying to integrate the application I wrote before for
Oracle to Mssql. The application works perfectly with Oracle with the
installed driver OCI8. The app retrives data based on a search criteria
from those databases.
I followed the directions
2006 Jun 27
2
how to use scope with acts_as_list
i am working on a task management system for the company i work for. i
just got the rails cookbook and am trying to use the section on creating
a drag and drop sortable list.
the tricky part is that my Task model references the User model in two
different spots. i have one field for the creator of the task and
another for the assignee. so in my Task model i have the following code:
class
2006 Apr 25
3
belongs_to and has_many
I know this has been rehashed many times, but I don''t get it.
I can''t find it documented to were I understand all the parts. I can
make this work using Rails database design conventions, but in this case
I am not able to do that.
I find examples, but the ones I find do not follow the conventions.
They also do not give enough information to understand what is going on.
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 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 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 Jul 01
0
activerecord generating wrong syntax with postgresql
I''m using activerecord outside of rails and find_first generates sql
that postgresql doesnt'' like. This is rails 1.1.4, with everything up
to date via "gem update".
This is the command line:
ruby -rrubygems seca -c ../etc/seca.cnf cert --export 1 --format
pkcs12 --key root.key >root.pfx
This is the error:
(PGError: ERROR: argument of WHERE must be type
2006 Oct 22
3
Keeping DRY - I like a simple life!
Hi,
I''m new to Ruby and Rails and I would be very grateful for some advice.
I''ve got the following code.
class Foo < ActiveRecord::Base
include Versionable # Some methods to handle my versioned objects
has_many :versions, :class_name => "FooVersion", :foreign_key =>
"parent_id"
belongs_to :curr, :class_name => "FooVersion",
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