Chris Parrish wrote:
> My question was originally tied to approach #1. I could use a Rake task
> to change the "javascript_directory" but couldn't get the
> already-running server to reload its routes.
>
> Now I'm working on having an augmented SiteController#show_page action
> process the whole thing (#2). If I use a before_filter to call my
> #show_text_asset action and it finds and renders the script/stylesheet,
> how to I then prevent things from proceeding on to #show_page?
>
> Will rails let you set up a before_filter against only one action,
> anyway?
>
>
> -Chris
I believe, in any rails before_filter if you call render or redirect_to,
it halts the filter chain and prevents further execution. This is
commonly used for access control. So as long as you render something,
it should works just as you need it too. Unless radiant does something
funky with rendering that I dont know about.
before_filter :authorize
def authorize
redirect_to login_url unless admin_logged_in?
end
And yes, you can fine tune your before filters by passing action names
to the :only or :except keys of the options hash.
before_filter :foo, :only => [:index, :show]
before_filter :foo, :except => [:create]
They are pretty flexible creatures.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant