Wow, I can’t believe that after a few weeks of playing around with Rails
I
got stuck on something that seems like it should be really simple.
How do I display a default welcome page for visitors who are not logged
in
and send logged in users to the appropriate controller. I am using the
login_engine and the user_engine.
The two methods I have seen looking at sample code are to stick a
http_refresh in public/index.html or to setup a default route to go to
some
action controller.
What do you suggest? Can I build a conditional route that sends them to
a
‘Welcome’ controller if not logged in or the “MyApp” controller if
logged
in? Does it make sense to build a ‘Welcome’ controller just for the
ability
to route for it and render content with a view even though there is no
real
functionality and no model?
I thumbed through the Agile w/ Rails book recently and it had that
worked
out using filters… There’s a before_filter which let’s you establihs a
routine to run, we’ll, before other things happed… I think putting it
in
your application controller gives it global access.
I thumbed through the Agile w/ Rails book recently and it had that worked
out using filters… There’s a before_filter which let’s you establihs a
routine to run, we’ll, before other things happed… I think putting it in
your application controller gives it global access.
Actually it’s the best way to do, in my opinion. Check this out!
Thank you both for the tips. I think I understand what you are
suggesting
and will probably do something like that for the overall access control
in
my app.
My confusion is embarrassingly much simpler.
I want a basic “Welcome to my site” page to show up at:
All of the routing and filter examples I see involve sending someone to
a
controller like:
Is the best way to customize the root level content for my account to
edit
index.html in the public folder? Will I be able to use my layout and
dynamic content (display whether the user is logged in or not)? When I
delete index.html, I get an exception that the controller for “/” could
not
be found. Why can’t I have a top level invisible controller with an
unseen
index action so that I can pull in dynamic content and my site-wide
layouts. I think this must be possible, but I am stuck for now.