On Thu, May 19, 2011 at 7:21 PM, egervari <[email protected]> wrote:

> Hi, I've just gotten started with devise and it's pretty nifty. I just
> wondered if people could point me in the right direction for finding
> info about 3 things.
>
> 1. How come the login form does not report error messages when the
> username/password is incorrect? I generated the views and replaced the
> form. I don't think I got rid of anything that would cause these
> errors to disappear, but I obviously must have.
> How can I get this error message back?
>

The messages are reported via the flash hash, make sure you have the 3
devise uses at all time, the best way to have all of them is iterating the
flash hash like this:

<%flash.each do |name, msg|%>
<%= content_tag :div, msg, :id => "flash_#{name}"%>
<%end%>



>
> 2. I have created custom methods for "inactive_message" and "active?",
> but the devise login form doesn't appear to be using them. How can I
> get devise to not log a user in when "active?" return false? The
> documentation says it should... but it's not working. What do I need
> to enable to get this behaviour?
>

you have t override this 2 methods in the user model:

     def active_for_authentication?
        true
     end

     def inactive_message
        :inactive

       end




> 3. For the registration page, I'd like to customize what the initial
> object is - it's a different subclass of the class knows about. I
> don't want to generate new controllers for this subclass just to get a
> different registration page. How can do that? I also want to add yet
> another registration page for a different user role - again, not
> creating the rest of the controllers (they are not needed).
>

you only need to add the devise module in the model class and the devise_for
in the routes, they both work together to help devise build the
corresponding authentication strategy and all that. you can add devise and
the modules you want to use to your subclass and then add devise_for
subclass in the routes and it should work.



>
> If these 3 questions mean I starting to push the bounds of what Devise
> was designed to do, then I guess I'd also like to know that as well.
> If I have to swap it out for a custom authentication system, it's good
> to know that ;)
>

not really, jose and carlos work hard to make devise very customizable and
it keeps getting better and better, but if you ever come to a point where
you need something very custom you should check authlogic.

-- 
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