El Thursday 27 November 2008 19:06:00 mr.gaffo escribió:
> I'd be happy to discuss with anyone how the view stuff works. The
> basics are:
>
> There is a view path that we all know and love, it's RAILS_ROOT/app/
> views, and when rails loads up it has just this. You're supposed to be
> able to add other view paths. This is partially so that you can move
> your mail only templates out to somewhere else and change ActionMailer
> to use say app/mail instead of app/view for the email templates. Or
> you can set the view_paths for ActionMailer to be app/views and app/
> mail and then you get stuff in both places.
>
> When it's looking for a template it goes something like this:
>
> For each view path it searches the cached set of templates by "path"
> in the following order
> - see if view_path/controller.class.name.underscore/view.#
> {contentype}.#{viewextension} exists
> - see if view_path/controller.class.name.underscore/view.#
> {contentype}.* exists
> - see if view_path/controller.class.name.underscore/view.* exists
> - AS Patch injects a check here to look for view_path/view
> - there are 2 other conditions I haven't really looked into
> - If none of these match, it creates a new Template object with all of
> the view paths, if the template can find a view, it caches that
> template under the "path", if it can't it throws a template not found
> exception
>
> One of the side issues with this that I see is that if you have say
> app/views/edit.html.erb for some reason, and you make an action in
> stories_controller without creating app/views/stories/edit.html.erb,
> it will pick up app/views/edit.html.erb when you have active scaffold
> installed. I didn't really think that was an issue so I ignored it.
>
> So with AS the template finding (which is done in
> active_scaffold.rb#_pick_template_with_generic I think) has the above
> logic AND I also told it to add the following to the view paths to
> search:
> - app/views/controller.class.name.underscore for controller level
> overrides
I removed it because it broke render :super, and I saw no difference without
it.
> - app/views/active_scaffold_overrrides for app wide overrides
> - PLUGIN_ROOT/frontends/#{theme}/views for the default active scaffold
> stuff.
>
> Let me know if you have more questions. I'm wondering if this
> shouldn't go on a developer page somewhere.
--
Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---