I am trying to make it possible for users to login as quick as possible, so I want users to be able to login and create records in the same form.
Is it possible to authenticate a user with the restful_authentication plugin from any controller by somehow calling the create method in the session controller, and return the authenticated user? It seems like this could be done easily somehow, but I just can't figure out how to do it in Rails.
Maybe something like:
#Records Controller def create if params[:login] && params[:password] #This method would call /session/ and pass the login/password params user = authenticate_user(params[:login'], params[:password]) end @record = Record.new(params[:record]) @record.user = user if @question.save && user flash[:notice] = 'Record was successfully created.' redirect_to(@record) end end
Any ideas on how to do this would be appreciated!