app.get '/namespace/controller'
works, but how can I:
The app object takes care of the session for you, so you don't need to worry about handling the session id manually. So, you just login, then access other pages that depend on the session being set:
app.post app.login_path, :username => "username", :password => "password"
app.get app.other_path
You can also inspect the response and session after any request, eg.:
app.response.redirect_url
app.session[:user_id] # assumes your login process uses the `user_id` key in your session
If you want, you can create a file called .irbrc in your $HOME directory, combining some of these ideas with something like this in it:
if Rails
def login
app.post app.login_path, :username => "username", :password => "password"
"Logged in with user_id: #{app.session[:user_id]}"
end
end
Then, in your Rails console you can just type login to issue that method, and it will return the string showing the value of the user_id session element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With