开发者

Simple Admin functionality in Rails 3

I want to add a admin functionality to my webapp with Rails version 3. I want something very simple, there will be only one admin, this funcionality d开发者_如何学JAVAoesn't need a username field, just a password field. I don't know how to do it, can you help me?

Thanks!


Have a look at this Railscast on HTTP simple authentication:

# products_controller.rb
before_filter :authenticate

protected

def authenticate
  authenticate_or_request_with_http_basic do |username, password|
    username == "foo" && password == "bar"
  end
end

As simple as that!


You can use scaffolding for generating form code and controller code.

http://guides.rubyonrails.org/getting_started.html#getting-up-and-running-quickly-with-scaffolding

and here is a simular question: Backend administration in Ruby on Rails

hth

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜