Suppose you need projects#index to be visible only to logged in users.

As Colin explained above, In your routes.rb put

root :to => projects#index

Devise provides you a method called authenticate_user! It checks if user is
logged in, if not it redirects the user to login page. In the
ProjectsController add a before_filter like this.

class HomeController < ApplicationController
  before_filter :authenticate_admin!

  def index
  ....
  end

  ....
end

So if the user is logged in he sees the page or else he is redirected to
the login page.

Gautam Pai

On Fri, Dec 23, 2011 at 1:43 PM, Lewisou <[email protected]> wrote:

> Are you kidding me?
>
> On Dec 23, 3:18 pm, wei jack <[email protected]> wrote:
> > Thank you tim,dave,colin.
> >
> > I get it. but find difficult to implement it.
> > could you guy teach me how to write the function ?
> > I'm new to ror.
> >
> > Thanks.
> >
> > --
> > 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.
>
>

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