Thanks. But I think the application still needs something more.
I defined those methods in my application_controller and added to my
"requuire login Method"
def require_login
unless user_signed_in?
redirect_to store_location=(request.fullpath)
redirect_to login_path,
alert: "Erst anmelden bitte!"
end
end
and added to my create method in the sessionscontroller:
def create
user = User.find_by_username(params[:username])
if user && user.authenticate(params[:password])
session[:user_id] = user.id
#redirect_to startscreen_path,
redirect_to store_location,
notice: "logged in"
When I now want to retrieve a page, that has the befor_filter "require
login"
I get the Error Message.
AbstractController::DoubleRenderError in GamesController#new
Render and/or redirect were called multiple times in this action. Please
note that you may only call render OR redirect, and at most once per
action. Also note that neither redirect nor render terminate execution
of the action, so if you want to exit an action after redirecting, you
need to do something like "redirect_to(...) and return".
When logging in directly (without filters), I get the Error Message
ActionController::ActionControllerError in SessionsController#create
Cannot redirect to nil!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment