[Rails] How can I change the notice to a text with a variable

2012-11-12 Thread roelof
Hello, I have this controller : class UserSessionsController ApplicationController skip_before_filter :require_login, :except = [:destroy] def new @user = User.new end def create respond_to do |format| if @user = login(params[:username],params[:password])

Re: [Rails] How can I change the notice to a text with a variable

2012-11-12 Thread Norbert Melzer
:notice = welcome #{@user.name} That's basic ruby knowledge Am 12.11.2012 12:19 schrieb roelof rwob...@hotmail.com: Hello, I have this controller : class UserSessionsController ApplicationController skip_before_filter :require_login, :except = [:destroy] def new @user = User.new

Re: [Rails] How can I change the notice to a text with a variable

2012-11-12 Thread Jordon Bedwell
redirect_back_or_to(:users, notice: Welcome, #{@user.username}) Though you shouldn't do that in the redirect, you should probably just make that a default part of the view if the session has a user_id. On Mon, Nov 12, 2012 at 5:19 AM, roelof rwob...@hotmail.com wrote: Hello, I have this