Hi,
I’m new to ruby on rails.
Can anyone tell me that how to do authentication for user.
Thanks,
Poonam
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…
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.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs