Hi there..
I have created a table and a join table
class CreateArrangements < ActiveRecord::Migration
def self.up
create_table :arrangements do |t|
t.column :name, :string
end
end
def self.down
drop_table :arrangements
end
end
****Join table**************
class AddTableArragementUsers < ActiveRecord::Migration
def self.up
create_table :arrangements_users, :id => false do |t|
t.column :arrangement_id, :integer, :null => false
t.column :user_id, :integer, :null => false
end
add_index "arrangements_users", "arrangement_id"
add_index "arrangements_users", "user_id"
end
def self.down
end
end
*************************
In the user-edit-view page a put in the following code:
<p><label
for="user[arrangement_ids][]">arrangement</label><br/>
<%= select_tag ''user[arrangement_ids][]'',
options_from_collection_for_select(@arrangement, :id, :name,
@user.arrangements.collect{|arrangement| arrangement.id}),
{ :multiple => true, :size => 5 }%>
</p>
But i get the following error
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.inject
Anyone idea?
Swoany
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---