Just to share with everyone.
the correct way to put the hash is:
@accesspoint.radgroupcheck_attributes = {:groupname =>
current_user.email, :value => params[:accesspoint][:shortname]}
Cheers,
Muhammad Nuzaihan
On Tue, Dec 10, 2013 at 11:51 PM, Jeremy Evans <[email protected]>wrote:
> On Tue, Dec 10, 2013 at 1:58 AM, Muhammad Nuzaihan Bin Kamal Luddin <
> [email protected]> wrote:
>
>> Sorry Jeremy for not adding more details with hopes everyone stops
>> guessing.
>>
>>
>> My Model:
>>
>> class Accesspoint < Sequel::Model
>>
>> many_to_one :user
>> one_to_one :radhuntgroup
>> one_to_one :radgroupcheck
>>
>> plugin :instance_hooks
>> plugin :nested_attributes
>> nested_attributes :radhuntgroup, :radgroupcheck
>>
>> end
>>
>> accesspoints_controller.rb
>>
>> def create
>> @accesspoint = Accesspoint.new(params[:accesspoint])
>> @accesspoint.user_id = current_user.id
>> @accesspoint.radgroupcheck_attributes = [{ :value =>
>> params[:accesspoint][:shortname]}, {:groupname => current_user.email }]
>>
>
> As radgroupcheck is a one_to_one association, you need to pass in a single
> hash, not an array of hashes:
>
> @accesspoint.radgroupcheck_attributes = { :value =>
> params[:accesspoint][:shortname]}, {:groupname => current_user.email }
>
> Also, I'm not sure if you intended this, but you responded to me directly
> instead of to the sequel-talk Google Group.
>
> Thanks,
> Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.