Ok, finally got around to checking this out (sorry, new baby!). This is a problem that has to do with the order that Rails loads controllers vs. plugins. The controllers in your app directory get loaded and mixed with the CE controller (Engines does this) before AppConfig has been defined (it gets definged later, when CE is loaded), thus the error.
For now, I'm not going to worry about this (especially with the changes to Engines coming in Rails 2.3). Probably the easiest way to solve it is to put a file called mce_options.rb in your app's initializers directory (see this pastie <http://www.pastie.org/379925>) Other solutions are welcome, but again, this will probably all change with Rails 2.3. Thanks, Bruno On Wed, Jan 28, 2009 at 12:18 PM, jak4 <[email protected]> wrote: > > Me too. And I can't figure out why. > > Just doing > class MyUsersController < UsersController > end > > results in the merge error (in Production of course). AppConfig is > partially set, as far as I can see, but default_tiny_mce and > simple_tiny_mce are definitely not there. > > Any Ideas, apart from doing "AppConfig.default_mce_options ||= {}"? > > On Jan 25, 6:52 am, sprite <[email protected]> wrote: > > I have the same issue. > > > > On Jan 16, 5:09 pm, simplicoder <[email protected]> wrote: > > > > > Here's a link to that file: > http://communityengine.googlegroups.com/web/ce-barebones-debug.zip > > > > > On Jan 16, 7:06 pm, simplicoder <[email protected]> wrote: > > > > > > Well I uploaded my barebones app so you can try it out for yourself, > > > > ce-barebones-debug.zip. > > > > > > It's a straight engines 2.2.2 & CE v0.10.8 install, with only two > > > > files in the app dir, a view file copy of offerings/ > > > > _chooser.html.haml ... and an users_controller copy only without any > > > > methods or anything in it. > > > > > > run script/server -e production > > > > > > when I and my coworkers on their respective macs try it, we have > > > > errors. > > > > > > I put the view one in there because it shows exactly how odd it is > > > > that production catches a haml error in the main app dir, but not in > > > > the engines dir. > > > > > > Check it out, lemme know how it works for you. > > > > > > On Jan 16, 6:00 pm, "Bruno Bornsztein" <[email protected]> > > > > wrote: > > > > > > > I think this might be specific to your environment. I have several > apps > > > > > where I'm overriding users_controller without problems. Anyone else > > > > > experience something like this? > > > > > > > On Fri, Jan 16, 2009 at 5:16 PM, simplicoder < > [email protected]> wrote: > > > > > > > > Ok so in order to be able to override users_controller at all, > you > > > > > > gotta add this line: > > > > > > > > AppConfig.default_mce_options ||= {} > > > > > > > > above this line, in the plugin's users_controller, line 15: > > > > > > uses_tiny_mce(:options => AppConfig.default_mce_options.merge > > > > > > ({:editor_selector => "rich_text_editor"}), > > > > > > :only => [:new, :create, :update, :edit, :welcome_about]) > > > > > > > > Then everything should work in production. > > > > > > > > Don't know why it cares so much about that in production and not > dev. > > > > > > > > I'd like to see a dev vs production documentation on the > differences > > > > > > and order-of-operations for engines, though maybe this is a rails > > > > > > problem, I dunno. > > > > > > > > On Jan 16, 4:53 pm, simplicoder <[email protected]> wrote: > > > > > > > Well that's kinda weird I guess... > > > > > > > > > What's worse is even if you have nothing in the top-level > > > > > > > users_controller except, > > > > > > > class UsersController < BaseController > > > > > > > end > > > > > > > > > It still throws the production exception, so there's no way to > > > > > > > override any methods for users I guess, except editing the > plugin's > > > > > > > users_controller.... I guess maybe with a mixin module would be > > > > > > > easiest. > > > > > > > > > On Jan 16, 3:10 pm, "Bruno Bornsztein" < > [email protected]> > > > > > > > wrote: > > > > > > > > > > You *can* override the whole controller, but in some cases > that will > > > > > > cause > > > > > > > > problems, as in your case. Because you replaced the whole > > > > > > users_controller, > > > > > > > > and users controller calls AppConfig when loaded, you got an > error in > > > > > > > > production, because your app's users_controller was being > loaded > > > > > > > > *before*AppConfig was set (it gets set in the CE plugin). > > > > > > > > > > On Fri, Jan 16, 2009 at 3:08 PM, simplicoder < > [email protected]> > > > > > > wrote: > > > > > > > > > > > Ok, I guess I didn't understand the way engines worked. > > > > > > > > > Apparently only methods can be overwritten. > > > > > > > > > > > I thought it would just be easier to copy the whole thing, > as the > > > > > > > > > engines docs say it simply overrides the plugin controller. > > > > > > > > > > > Thanks for your help! > > > > > > > > > > > On Jan 16, 2:47 pm, "Bruno Bornsztein" < > [email protected]> > > > > > > > > > wrote: > > > > > > > > > > You *shouldn't* be copying the entire controllers out of > CE. You > > > > > > just > > > > > > > > > need > > > > > > > > > > to override the particular actions you'd like to change. > > > > > > > > > > > > On Fri, Jan 16, 2009 at 2:05 PM, simplicoder < > > > > > > [email protected]> > > > > > > > > > wrote: > > > > > > > > > > > > > Yes I copied it straight out, no mods or anything. > > > > > > > > > > > The plugin order in environment.rb is what you said to > put... > > > > > > > > > > > > > Now the comments_controller is giving me fits. > > > > > > > > > > > I copy it straight out of the plugin to the main app > dir... no > > > > > > > > > > > modifications. > > > > > > > > > > > > > Works fine in dev. > > > > > > > > > > > But in production I get this error: > > > > > > > > > > > NoMethodError in CommentsController#create > > > > > > > > > > >undefinedmethod`controller_name' for nil:NilClass > > > > > > > > > > > > > Try it out with a fresh rails project and CE install... > just > > > > > > overwrite > > > > > > > > > > > the comments_controller and see if the same thing > doesn't happen > > > > > > for > > > > > > > > > > > you in production mode... > > > > > > > > > > > > > I don't know if it's an engines problem or if > production rails is > > > > > > > > > > > ignoring the config.plugins directive or what. > > > > > > > > > > > > > If anyone gets it to work please zip it up and post it > somewhere > > > > > > for > > > > > > > > > > > me, so I can diff it, because I'm hella stumped. > > > > > > > > > > > > > Thanks for any help! > > > > > > > > > > > > > On Jan 16, 8:58 am, "Bruno Bornsztein" < > > > > > > [email protected]> > > > > > > > > > > > wrote: > > > > > > > > > > > > Hmm.. this isn't happening to me on my production > sites. Anyone > > > > > > else > > > > > > > > > > > seeing > > > > > > > > > > > > this? > > > > > > > > > > > > > > Looks like line 15 of UsersController is calling > > > > > > > > > > > > AppConfig.default_mce_options, which for some reason > is > > > > > >undefinedat > > > > > > > > > that > > > > > > > > > > > > time. Might have something to with the plugin's load > order. > > > > > > > > > > > > > > Have you copied the entire UsersController out of CE > and put it > > > > > > in > > > > > > > > > your > > > > > > > > > > > own > > > > > > > > > > > > app directory? > > > > > > > > > > > > > > On Fri, Jan 16, 2009 at 1:42 AM, simplicoder < > > > > > > [email protected]> > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > So the problem was trying to override > users_controller by > > > > > > copying > > > > > > > > > it > > > > > > > > > > > > > out of the plugin into the main app dir. > > > > > > > > > > > > > > > It seems to have config code that calls > AppConfig... and > > > > > > production > > > > > > > > > > > > > mode doesn't like this?? > > > > > > > > > > > > > > > On Jan 16, 12:21 am, simplicoder < > [email protected]> > > > > > > wrote: > > > > > > > > > > > > > > I'm using CE v0.10.8 and engines 2.2.2 > > > > > > > > > > > > > > > > I've also tried the master branch... > > > > > > > > > > > > > > -=C=- > > > > > > > > > > > > > > > > On Jan 15, 7:40 pm, simplicoder < > [email protected]> > > > > > > wrote: > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > I'm having trouble running my CE app in > production mode. > > > > > > > > > > > > > > > Dev mode works fine. > > > > > > > > > > > > > > > > > Please check out this pastie: > http://pastie.org/362037 > > > > > > > > > > > > > > > > > When doing a rake:db:migrate in production I > get this: > > > > > > > > > > > > > > > rake aborted! > > > > > > > > > > > > > > >undefinedmethod`merge' for nil:NilClass > > > > > > > > > /Users/csmos/Projects/community/vendor/plugins/community_engine/app/ > > > > > > > > > > > > > > > controllers/users_controller.rb:15 > > > > > > > > > > > > > > > > > It works fine in dev as shown in the pastie. > > > > > > > > > > > > > > > > > I thought maybe for some reason it wasn't > executing the > > > > > > > > > > > engine_config/ > > > > > > > > > > > > > > > boot... > > > > > > > > > > > > > > > so I put this at the end of my evironment.rb > file... > > > > > > > > > > > > > > > > > p 'BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH' > > > > > > > > > > > > > > > # Community-engine boot > > > > > > > > > > > > > > > require > > > > > > > > > > > > "#{RAILS_ROOT}/vendor/plugins/community_engine/engine_config/ > > > > > > > > > > > > > > > boot" > > > > > > > > > > > > > > > > > the BLAHs get output in the successful dev > enviro, but > > > > > > not > > > > > > > > > > > production. > > > > > > > > > > > > > > > > > I'm stumped, any thoughts are appreciated. > > > > > > > > > > > > > > > Thanks! > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CommunityEngine" 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/communityengine?hl=en -~----------~----~----~----~------~----~------~--~---
