Hi Ian, Cheers for the feedback, and what you assume is correct. I'm looking to setup a "default" theme, then have other themes stacked on top of that. I can get the views to load from /app/views/default/.etc. fine - it's the layoust I'm having issues with. The layouts simply do not want to load from that location, and I'm trying to understand why.
Cheers =) On Tue, Mar 3, 2009 at 6:22 PM, Ian White <[email protected]> wrote: > Hi, > > If I understand you, you want app/views/default to contain a default > layout, and perhaps other 'default' templates. If I've misunderstood this, > ignore the following. > > Setting view_paths will not allow you to specify a default set of views in > this way. view_paths lets you specify different locations where views are > found, but they are always found using the controller_path. > > So, if your view_paths are 'app/views', and 'app/views/default', when the > FooController looks for index, it will search for > > app/views/foo/index > app/views/default/foo/index > > Have you tried inherit_views plugin? ( > http://github.com/ianwhite/inherit_views). To achieve your example with > inherit_views: > > class ApplicationController < ActionController::Base > inherit_views 'default' > end > > Cheers, > Ian > > On 3 Mar 2009, at 06:15, Torm3nt wrote: > > > > Okay, thought maybe I'd give a little more info here to see if anyone's > interested in actually testing this out. > > I've tried this in Rails 2.3.0RC1, using the following code within the > application_controller.rb file: > > class ApplicationController < ActionController::Base > helper :all # include all helpers, all the time > protect_from_forgery # See ActionController::RequestForgeryProtection for > details > > before_filter :set_theme > > # Scrub sensitive parameters from your log > # filter_parameter_logging :password > > def set_theme > self.view_paths = [] > self.prepend_view_path File.join(RAILS_ROOT, 'app', 'views', 'default') > end > end > > As you can see, I'm setting the view_paths directory to a "theme" > directory, like so: /app/views/default > > Within that folder, I have the appropriate views for controllers.etc, as > well as the layouts sub-directory. > > Views are loading fine - layouts are not. I've even tried applying the > patch from Rails Edge which supposedly fixes the problem, all to no avail. > I've tried numerous plugins, only to have the exact same problem. Is anyone > able to help out in resolving this issue? Can supply a zipped up version of > a test project we've been using to spike this issue out. > > > Kirk > > On Tue, Mar 3, 2009 at 3:44 PM, Torm3nt <[email protected]> wrote: > >> Anyone? >> >> >> >> On Tue, Mar 3, 2009 at 1:59 PM, Torm3nt <[email protected]> wrote: >> >>> Revisiting this issue - have received approval to go ahead and do a rails >>> 2.2.0 spike and see if I can get it to work - exact same problem. Layouts >>> will not load even when view_paths are set correctly. It loads the views >>> fine, just not layouts. >>> >>> GRRRR >>> >>> >>> >>> >>> On Fri, Feb 27, 2009 at 4:32 PM, Torm3nt <[email protected]> wrote: >>> >>>> Yeah, something to think about in future - unfortunately it doesn't help >>>> my current problem, and I know I won't be given the time or budget to >>>> upgrade the systems (which would involve 3 separate teams), at least for >>>> some time =( >>>> >>>> >>>> >>>> On Fri, Feb 27, 2009 at 4:29 PM, Clifford Heath < >>>> [email protected]> wrote: >>>> >>>>> >>>>> On 27/02/2009, at 4:20 PM, Torm3nt wrote: >>>>> > For us to upgrade our applications all to 2.3.0, to run our tests >>>>> > and get it all going, update dependencies, >>>>> >>>>> Perhaps you should instead focus on making sure that your apps >>>>> have the appropriate gem version dependencies declared so that >>>>> you can upgrade any one of them without having to worry about >>>>> the others? Though rubygem's weak dependency mechanism might >>>>> prevent you there. >>>>> >>>>> Clifford Heath. >>>>> >>>>> >>>>> >>>> >>> >> > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" 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/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
