On Martes, 7 de Julio de 2009 18:19:22 Chris Eppstein escribió:
> I did try that and it doesn't work for partials -- at least not in
> rails 2.3. It used to work when we were on 2.1.
>
> I'm simply trying to share override partials among a set of
> controllers that inherit from a common base class.
>
> Without these changes, only the view directory of the subclass gets
> considered. If you say there's a better way, I'll believe you, but can
> you please provide a simple working example? I've spent 3 days on this
> problem now and I know rails pretty well.
>
> Chris

Thanks for your patch, I have commit some changes (not exactly as your patch) 
and now you can share override partials in active_scaffold_overrides directory 
for all controllers, or add some path to active_scaffold_overrides (with 
add_active_scaffold_override_path) to some controllers to share override 
partials

>
>
> Hunt & pecked on my iPhone... Sorry if it's brief!
>
> On Jul 7, 2009, at 8:40 AM, "Sergio Cambra .:: entreCables S.L. ::."
> <[email protected]
>
>  > wrote:
> >
> > On Martes, 7 de Julio de 2009 03:27:40 Chris Eppstein escribió:
> >> Ok. I realized that the patch I made was failing because rails
> >> itself wants
> >> to find the partials within a controller directory. So I took a
> >> slightly
> >> different tack with great success. I exposed a method that
> >> controllers can
> >> call called "add_active_scaffold_override_path" to tell active
> >> scaffold
> >> where to look for shared partials. I then modified the
> >> generic_view_paths
> >> module to look for partials within the overrides path if not found
> >> elsewhere.
> >> The commit is here:
> >> http://github.com/caring/active_scaffold/commit/ce40a388318180226103e024
> >>d8e b8890abdfd556
> >>
> >> Of course, if you can suggest a better way, I'm open to it.
> >
> > I'm not sure what you want, but I think you would only need to prepend
> > (unshift) the path in @active_scaffold_overrides, without more
> > changes in
> > generic_view_paths module.
> >
> > What views do you want to put and share in that path?
> >
> >> Thanks,
> >> Chris
> >>
> >> On Fri, Jul 3, 2009 at 10:25 AM, Chris Eppstein
> >>
> >> <[email protected]> wrote:
> >>> That didn't fix it either.
> >>> The problem is that partial_pieces on line 70 is returning:
> >>>
> >>> controller.class.controller_path, partial_path
> >>>
> >>> The controller path here is the path to
> >>> my subclass so override_form_field_partial? returns false because
> >>> the
> >>> explicit path doesn't exist, only the inferred path does.
> >>>
> >>> I went down the path of trying to remove partial_pieces altogether
> >>> and
> >>> replace it with a method that returns a string that add the "_"
> >>> before
> >>> the partial name.
> >>>
> >>> Here's a diff of the changes I made:
> >>> http://gist.github.com/140227
> >>>
> >>> This made template_exists? find the partial template correctly,
> >>> but the
> >>> render :partial on line #10 of
> >>> vendor/plugins/active_scaffold/frontends/default/views/
> >>> _form.html.erb
> >>> then failed to find the partial template. I don't know what
> >>> changes have
> >>> been made that would cause render :partial to not find a template
> >>> on the
> >>> view_path. I also don't know what use cases these changes might
> >>> break.
> >>>
> >>> A fix for this issue would be much appreciated, it is one of the
> >>> last
> >>> issues gating our release of rails 2.3.
> >>>
> >>> Thanks,
> >>> Chris Eppstein
> >>>
> >>> On Fri, Jul 3, 2009 at 1:19 AM, Sergio Cambra .:: entreCables
> >>> S.L. ::. <
> >>>
> >>> [email protected]> wrote:
> >>>> On Jueves, 2 de Julio de 2009 16:23:04 Chris Eppstein escribió:
> >>>>> Yes, I am. The problem is that the controller_path of the
> >>>>> subclass is
> >>>>> getting explicitly added to the override partials, causing the
> >>>>> PathSet
> >>>>
> >>>> to
> >>>>
> >>>>> not find
> >>>>> the partial in the view path. I'm pretty sure you do this due to
> >>>>> the
> >>>>> complexities around nested scaffolds...
> >>>>> chris
> >>>>
> >>>> Try with add_active_scaffold_path  'app/views/parent_controller'
> >>>> after
> >>>> active_scaffold configure block
> >>>>
> >>>>> On Thu, Jul 2, 2009 at 12:57 AM, Sergio Cambra .:: entreCables
> >>>>> S.L.
> >>>>>
> >>>>> ::.
> >>>>
> >>>> <
> >>>>
> >>>>> [email protected]> wrote:
> >>>>>> On Jueves, 2 de Julio de 2009 06:32:16 Chris Eppstein escribió:
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> We're upgrading to rails2.3 and have just taken the master
> >>>>>>> branch
> >>>>>>> of AS from June 9th or so as our current version of active
> >>>>>>> scaffold.
> >>>>>>>
> >>>>>>> We've always kind-of hacked to get our controllers to inherit
> >>>>>>> form
> >>>>>>> partial overrides from the super class controller by adding an
> >>>>>>> explicit prepend_view_path to the subclass controller with the
> >>>>>>> view path of the parent. But now that doesn't seem to work
> >>>>>>> anymore
> >>>>>>> (the override is not found and we get the default nested form
> >>>>>>> for
> >>>>>>> the association). We spent most of the day reading through the
> >>>>>>> code and trying to see what to do, to no avail.
> >>>>>>>
> >>>>>>> What is the recommended way to have one active_scaffold
> >>>>>>> controller
> >>>>>>> inherit partial overrides from the superclass controller?
> >>>>>>
> >>>>>> I think it should work. Are you prepending the path before you
> >>>>
> >>>> configure
> >>>>
> >>>>>> active_scaffold for that controller?
> >>>>>>
> >>>>>>> Thanks,
> >>>>>>> Chris Eppstein
> >>>>>>
> >>>>>> --
> >>>>>> Sergio Cambra .:: entreCables S.L. ::.
> >>>>>> Mariana Pineda 23, 50.018 Zaragoza
> >>>>>> T) 902 021 404 F) 976 52 98 07 E) [email protected]
> >>>>
> >>>> --
> >>>> Sergio Cambra .:: entreCables S.L. ::.
> >>>> Mariana Pineda 23, 50.018 Zaragoza
> >>>> T) 902 021 404 F) 976 52 98 07 E) [email protected]
> >
> > --
> > Sergio Cambra .:: entreCables S.L. ::.
> > Mariana Pineda 23, 50.018 Zaragoza
> > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> 
-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to