Hi, If I''m using STI with Devise, I have a Admin model inheriting the base Devise User model. I would like to remove ''registerable'' from the Admin model but it inherits registerable from the user model. How would i disable registration for admins? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
bump On Aug 10, 11:42 am, jdkealy <jdke...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > If I''m using STI with Devise, I have a Admin model inheriting the base > Devise User model. I would like to remove ''registerable'' from the > Admin model but it inherits registerable from the user model. How > would i disable registration for admins?-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 10 August 2011 17:42, jdkealy <jdkealy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > If I''m using STI with Devise, I have a Admin model inheriting the base > Devise User model. I would like to remove ''registerable'' from the > Admin model but it inherits registerable from the user model. How > would i disable registration for admins?I don''t use Devise but can you not just define a registerable method in your Admin model? 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
A little late to the party, but I just ran into the same issue. I have my User model set up, and my AdminUser model is inheriting from the User model. Technically, you cannot ''remove'' the ''registerable'' module from your Admin model without removing it from the User model. We can still set up what you want, but we need to go about it a little differently. Basically, the Admin model inherits the devise_modules from the User model. Since it is inheriting this, a new devise_modules variable is not created, but the original one is pointed to. Since Admin is pointing to the original, removing anything from that removes it from the original. In order to accomplish your goal, we are going to duplicate the original so that Admin has it''s own copy of devise_modules. The following is how I am handling this. class AdminUser < User self.devise_modules = User.devise_modules.dup self.devise_modules.delete(:registerable) end NOTE: In my situation I wanted to keep the same devise_modules for Admin, with the exception of registerable. You could also do something like the following and simply set the ones you want for Admin. class AdminUser < User self.devise_modules = [:database_authenticatable, :rememberable] end Hope that gives a little insight and helps anybody else trying to go about this. On Wednesday, August 10, 2011 11:42:46 AM UTC-5, jdkealy wrote:> > Hi, > > If I''m using STI with Devise, I have a Admin model inheriting the base > Devise User model. I would like to remove ''registerable'' from the > Admin model but it inherits registerable from the user model. How > would i disable registration for admins?-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/IKU4iKkscWQJ. For more options, visit https://groups.google.com/groups/opt_out.