Hi Tomas,

Try changing your mass-assignment protection line to:

    attr_accessible :profile_attributes

If that still doesn't work send your view code.  If you haven't
already ready read the nested attribute docs, they explain things
pretty well:  
http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html

Matt Daubert


On May 14, 10:35 pm, "Tomas R." <[email protected]> wrote:
> Im making nested attributes for profile on the user model and I also
> need to validate the profile info
> so I put
>
> User model
>
>   has_one :profile
>   accepts_nested_attributes_for :profile
>   validates_associated :profile  <--- To validate values
>   attr_accessible :profile  <----to allow mass assingment
>
> Profile model
>
>   belongs_to :user, :dependent => :destroy
>   >>> Some Validations <<<
>
> But Im getting
>
> Profile(#30752520) expected, got
> ActiveSupport::HashWithIndifferentAccess(#26724528)
>
> Becouse of the
>   attr_accessible :profile
> I think, but if I dont have that line I cant enter values for profile,
> Anyways. when I take that line off, my profile forms isn't validated,
> this problem come when changing to rails 3.0.7
>
> --
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to