On 10 November 2011 11:46, Siva Prasad <newror.u...@gmail.com> wrote:
> Gurus,
>
> Ok, I got chance to rework on it today.As Colin suggested i debugged the
> code with  the ruby debugger. Below is the details explained.
>
> Controllers:
>
> site_controller.rb
> ------------------------------------
> def new
>
> @site=site.new
> @site.users.build
>
> end
>
> def create
>
> @site=site.new([:params])
> debugger
> ###### code i have added #######
> @site.users         (using debugger i did p @site.users it prints the
> usertable with values i have given in form but role = nil because i dont
> take role value in form)
> @test=@site.users
> @test.role='admin'  (using debugger i did p @site.users it prints the

@test is an array of users, I don't understand how you can do
@test.role='admin'.  I would have expected it to produce an error.

> usertable with values along with role as admin) But DB is not updated.
> ##############################
>
> end

You don't appear to have saved anything to the database.

Colin

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to