On Jan 12, 2008, at 4:26 PM, Michael Koziarski wrote:
> The special-case nature of 'application.rb' is a bit of a smell, and > judging by the torrent of +1 votes on this ticket, there are a lot of > people who feel that way. > > http://dev.rubyonrails.org/ticket/10570 > > So, if we want to ship something like this in 2.1 we should make sure > it's going to work well. So in addition to renaming the file in newly > generated applications, we'll need to have a strategy for people > upgrading from earlier versions. > > Ideally rake rails:update would be able to warn the user that the file > needs to be renamed, if not do the rename itself. If possible it'd > be nice to support both names for a while in trunk to avoid any > surprises for people running on edge[1]. > > Will this change enable any new 'stuff' that at present you can't do? > Referencing controllers from production.rb being the obvious case. > > Finally, as we'd no longer be preloading ApplicationController, is > there anything which might be relying on this? > > I'm definitely keen on fixing it up, I'm just worried that a torrent > of empty +1s may swamp any back-and-forth about the risks and benefits > to making the change. > > [1] I think you're crazy to be running on edge right now, but some > people like it :) sounds like a good move in general, but i don't know if it's worth it without really considering the goal of the original ApplicationController and how it basically falls down on the job. let me explain: it's bothered me to no end that rails doesn't really support any sort of centralized view of what the hell and application does, especially for a developer inheriting a project. application.rb is a nice spot not only for sharing behavior across controllers, but also for monkey patching junk in in a way that people are likely to notice it. however, we have no such equivalent for models or the app as a whole - only views share something similar. lately i've been doing this app/api.rb and putting all my config, all my thick model stuff, and all the high level stuff for my app that people should be able to use. i won't go into the details other than to point out i think we sorely need something like App.google_ad_client 'pub-1234' App.create_user email, password App.model do default 'rating' => 42 end so a central set of base classes for models, controllers, views and also config. the reason i mention this is that 'application.rb' is a *perfect* name for such a file. of course i can't use it so i use api.rb, site.rb, or sometimes app.rb. none of them feels right however. so my basic concern is not so much that 'application.rb' is named poorly, rather it is that it does very little to aid adding a central entry point for developers which, imho, something named that way should. seems worth considering since another location for application.rb with different roles, including that if setting up a base controller, might suggest an all together different migration strategy. kind regards. a @ http://drawohara.com/ -- sleep is the best meditation. h.h. the 14th dalai lama --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
