Return current signed
useror nil, if the user is not signed in
trueif the user is signed in
Returns a URL based on the path and options provided. It does not try to validate the URL, it only generates it and assume it's a valid URL.
path: The relative path of the URL you want to build.
options: Hash containing options for rendering the url.
optionsare linked together via a mapping construct that you can use to map records to part of the URL.
To map records to the
path, you need to specify the record & the method you want to use inside the path.
url('/admin/posts/:posts.id', post: @post) -> '/admin/posts/32'
The method looks for every occurence of “:[key].” and will look in
optionsfor that key and call the given method on that key.
This means the object can be anything as long as it handles the method.
Here are a other examples:
url('/users/:user.id/tags/:tag.id/', user: @user, tag: @tag) -> '/users/12/tags/12' url('/users') -> '/users'
optionsalso looks for the
absolute_pathkey. If it's set to
true, the method will return an absolute path.
url('/users/:user.id/tags/:tag.id/', user: @user, tag: @tag, absolute_path: true) -> 'http://localhost:3000/users/12/tags/12' url('/users', absolute_path: true) -> 'http://localhost:3000/users'