El Thursday 27 November 2008 22:32:05 Adam Salter escribió:
> Using the latest version on github of AS (which includes the latest
> commit titled 'fix render :super'), and Rails 2.2.2
>
> I created a file
> app/views/projects/list.html.haml
>
> in that file was:
> = render :super
>
> the output to the browser was:
> <layout stuff>
> /User/adam/dev/air_timesheets/app/views
> </layout stuff>
>
> Unless I'm doing something wrong I'm pretty sure that that output is
> not correct.
I have a controller users with a app/views/users/list.rhtml with:
<p>override</p>
<%= @controller.class.view_paths.inspect %>
<%= render :super %>
And it's working. Maybe is a problem with haml extension.
>
> On 28/11/2008, at 5:06 AM, mr.gaffo wrote:
> > 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
> > - 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
-~----------~----~----~----~------~----~------~--~---