Authentication

Hi,

I’m new to ruby on rails.

Can anyone tell me that how to do authentication for user.

Thanks,
Poonam

wow … i should read the preview more careful next time…

  1. forgot a colon in the 2nd before_filter
  2. it’s “Login Engine”
  3. it’s “active_rbac”

Well the basic behind it is to add a before_filter to the controllers
you want authentication for.
You can also include only or exclude specific actions

class ApplicationController …

before_filter :authenticated, :except [:list,:show]
OR
before_filter :authenticated :only [:create,:edit,:delete]


your normal actions

private
def authenticated
…check user permissions…
…return true or false …
end

end


As i’m really new to Rails myself and just put the above stuff
together from the top of my head, its no real working code, just a
symbolic description, i hope you get the idea.

See the api docs for more info on before_filter

There are also plugins and Engines for authentication systems out
there, google for “Login Enine” or “Ative_rbac”
you can learn a great deal from their code.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs