Conditional root_url (index)
Posted
by vise
on Stack Overflow
See other posts from Stack Overflow
or by vise
Published on 2010-02-04T22:57:37Z
Indexed on
2010/05/02
8:07 UTC
Read the original article
Hit count: 180
ruby-on-rails
I'd like my application to display different data on the frontpage depending on whether the user has been logged in or not.
def index
if current_user
# render another controllers action
else
# render another controllers action
end
end
I can achieve this by using render_component. However it has been obsolete for some time. Although I can still use it as a plugin, I'm interested if anyone has a better approach. Just take in mind that rendering another controller's view directly is not an option.
Thanks.
© Stack Overflow or respective owner