Answer the question
In order to leave comments, you need to log in
Way to authorize admin in rails application?
For the purpose of self-education, I wrote a blog using the ruby on rails framework.
Blog single user - only admin and anonymous visitors. For the first time, I used the most primitive "authentication" for administration, registered the code in the article controller:
class ArticlesController < ApplicationController
before_filter :master, :only => [ :new, :edit, :destroy ]
def new
...
end
... # и другие методы
private
def master
authenticate_or_request_with_http_basic do |email, password|
email == "******"
password == "******"
end
end
end
Answer the question
In order to leave comments, you need to log in
Devise
Differences that today the user one - is not present. Tomorrow you will want to collect a database of user emails for mailing and give access to comments after authenticating through social networks. networks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question