|
Re: Re: RESTful mixin, mixin repo?: msg#00025lang.ruby.camping.general
> I'm not sure I quite understand this... what does MagicModuleIncluder > do that simply including modules doesn't? (As in: http:// > code.whytheluckystiff.net/camping/wiki/BeforeAndAfterOverrides) What > sort of stuff do you have in mind for these components? So, I haven't entirely got to the bottom of this yet, but let's at some examples of include not working as I want. (As to what I want: entire MVC stacks that I can drop into different apps - eg. a user login engine that works in any app a /user and provides some useful predicates - is_logged_in?, etc...) So, I've created a little app that holds "Things." Nothing more than a title. Super simple. Now that I have my thing engine working, I want to incorporate it into another app. I comment out some stuff that would seem to conflict (eg. the layout view, the Index controller, Camping.goes :SimpleApp). You can see it here: http://pastie.caboo.se/23577 Seems straight forward, yes? Now let's include it in another app. We take a direct approach and include each part of the MVC stack in the appropriate part of our app. See the "Simpler" app here: http://pastie.caboo.se/23578 Try to run it. No luck: [mark 18:14:11 app]$ camping simple_app.rb !! trouble loading simpleapp: [NameError] uninitialized constant Base /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/i386/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing' /Users/mark/Documents/Programming/Ruby/campingtest/app/simple_app.rb:13 Hmm. Strange. While I don't think it's a good idea, let's try to uncomment the Camping.goes :SimpleApp line in our included MVC. Try to launch. Success (or so we think). The index page works. It's all good, right? Let's try to look at our "things"http://localhost:3301/thing Camping Problem! SimpleApp::Controllers::Thing.GET NoMethodError no such method `list_thing': ... Uh oh. Something's borked. I haven't figured out how to solve this problem, but I'm sure it's solvable. But you can see the problem. Looking at the camping code itself, it clearly does some unusual stuff to add apps to the mix. Like eval'ing a gsub version of the camping file itself. That kind of stuff is wild, but it makes it hard to anticipate exactly how to hook into the system. As Jonas's emails on the subject indicate, Equipment has been wrestling with this problem. I'm going to keep hacking on this. Perhaps I'll have a better solution soon. Also - feel free to point out why I'm an idiot. :-) -Mark
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Camping S5 Presenter App, Geoffrey Grosenbach |
|---|---|
| Next by Date: | Re: Re: RESTful mixin, mixin repo?, Jonas Pfenniger |
| Previous by Thread: | Re: RESTful mixin, mixin repo?, Michael Daines |
| Next by Thread: | Re: Re: RESTful mixin, mixin repo?, Jonas Pfenniger |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |