On 8 November 2011 00:28, newrails user <newror.u...@gmail.com> wrote: > So This is what it is happennig, the role assign works well if i create user > normally from its own view, But if I create the user form the site creation > view. the role assignment statement (resource.role="siteadmin") doesnt work. > This code exisits in the user controller.
I think it most unlikely that the assignment statement (resource.role="siteadmin") does not work. I think that after this statement then resource.role will most definitely be "siteadmin", unless you mean that there is an error of some sort when the statement is run. Presumably what you mean is that later on you find that the role is no longer "siteadmin", presumably due to it not being saved or being overwritten later for example. What you have to do is to follow the logic flow after that statement and work out what is going wrong. I suggest you have a look at the Rails Guide on debugging for some suggestions on how to do this. Look particularly at how to use ruby-debug to break into your code and inspect data and follow the flow. Colin > > Any inputs would be appreciated. > > Thanks, > Siva > > On Tue, Nov 8, 2011 at 5:27 AM, newrails user <newror.u...@gmail.com> wrote: >> >> HI Gurus, >> >> I could achieve this, I wanted to updated a filed in user table without >> taking input from user as asked before.I wanted to set a role to user >> without taking input from user.So in registration_controller action of >> (devise) I have set resource.role='siteadmin'.But its not taking that it >> always takes the default value provided for the field.Before integrating >> with nested fileds this piece of code to assign role used ot work.but not >> anymore. Is there something extra that i am not doing ? >> >> Thanks, >> --S >> On Sat, Nov 5, 2011 at 9:55 PM, Colin Law <clan...@googlemail.com> wrote: >>> >>> On 5 November 2011 15:19, newrails user <newror.u...@gmail.com> wrote: >>> > Hi Gurus, >>> > >>> > I wanted to add siteadmin user(basically a user with a certain role) >>> > while >>> > creating the site itself. I hope that i have done all the necessary >>> > stuff >>> > by going through raynb's railscasts >>> > (http://railscasts.com/episodes/196-nested-model-form-part-1) But >>> > could not >>> > see user fields being displayed in the site creation form.. Below are >>> > the >>> > details. >>> > >>> > I Have two model users and sites. ( user model was created using >>> > devise >>> > then i customized it). >>> > >>> > Below are my models: >>> > >>> > User model >>> > ------------------------------- >>> > class User < ActiveRecord::Base >>> > belongs_to :sites ########### I have added this >>> >>> Also that should be :site singular. >>> >>> 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. >>> >> > > -- > 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. > -- gplus.to/clanlaw -- 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.