rodrigoalvesvieira
rodrigoalvesvieira

Reputation: 8062

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 doesn't need a username field, just a password field. I don't know how to do it, can you help me?

Thanks!

Upvotes: 4

Views: 2840

Answers (2)

funkycottleti
funkycottleti

Reputation: 298

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

Upvotes: 2

Skilldrick
Skilldrick

Reputation: 70879

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!

Upvotes: 6

Related Questions