just a thought without testing:
try changing
<select name="user[regions][]"
multiple=''multiple'' >
to
<select name="user[region_id][]"
multiple=''multiple'' >
On Dec 24, 10:54 am, Luca Roma
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> class User < Core
> has_and_belongs_to_many :regions
> end
>
> class Region < ActiveRecord::Base
> has_and_belongs_to_many :users
> end
>
> I must to do a form with a multiple select to insert more regions for a
> user.
> i do so:
>
> <form ....>
> <input name="user[name]" type="text" />
> <select name="user[regions][]"
multiple=''multiple'' >
> <option value="1">Marche</option>
> <option value="2">Veneto</option>
> </select>
> </form>
>
> in method called from action from i have this:
> @user=User.create(params[:user])
>
> If i submit the form i receive an error.
> How i can insert rows in table regions_users??
> Thanks
> --
> Posted viahttp://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
-~----------~----~----~----~------~----~------~--~---