Got it. That's sort of what I expected. Is there anything specific to CE for overriding controllers? Do I just create a controller with the same name as the CE controller, and let Ruby fold the two together?
On Fri, Jan 16, 2009 at 9:55 AM, Bruno Bornsztein < [email protected]> wrote: > Well, making CE use NewUser instead of User in every instance isn't going > to be easy (since CE uses User all over the place, in controllers and > models. More likely, you'll want to use NewUser in any custom areas of the > app (like your own controllers), or parts of CE controllers that you > override (i.e. if you override the UsersController#show action or > something). To do that, use the "becomes" method in a before_filter: > > before_filter :become_new_user :only => :show > > def becomes_new_user > @current_user = @current_user.becomes(NewUser) > end > > > > > On Thu, Jan 15, 2009 at 10:26 PM, Carl Fyffe <[email protected]> wrote: > >> >> Ah HAH! I was on my blackberry when I responded earlier. There is a >> wiki page! Yay for Bruno. >> >> >> http://sites.google.com/a/curbly.com/communityengine/customizing-ce-1/overriding-ce-models >> >> Check it out. If that doesn't help then ask some questions so we can >> upgrade the page to make it better. >> >> Carl >> >> On Thu, Jan 15, 2009 at 11:21 PM, Chris Lee <[email protected]> >> wrote: >> > >> > I'm new to the list, so I apologize if this has been discussed, but why >> can't you do something like this: >> > >> > require_dependency RAILS_ROOT + >> "/vendor/plugins/community_engine/app/models/user" >> > >> > class User >> > >> > def display_name >> > "my custom name" >> > end >> > >> > end >> > >> > >> > ----- Original Message ---- >> > From: Carl Fyffe <[email protected]> >> > To: [email protected] >> > Sent: Thursday, January 15, 2009 9:58:39 PM >> > Subject: [CommunityEngine] Re: overriding models >> > >> > >> > Bruno, >> > >> > We get this question often on the list. Is there a wiki page that >> > describes how to do this? It is a use case that most developers will >> > need to use and will be a great example of how to extend the >> > functionality. >> > >> > Carl >> > >> > On 1/15/09, Brandon <[email protected]> wrote: >> >> >> >> I know how to override models, but one thing I don't understand is how >> >> CE knows how to use my new model. For example, I'm going to have to >> >> add some new roles, and then override the User with some logic that >> >> makes use of those roles. >> >> >> >> class NewUser < USer >> >> >> >> end >> >> >> >> Fair enough...but how do I let CE know it needs to always use NewUser, >> >> and not user? >> >> >> >> 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 -~----------~----~----~----~------~----~------~--~---
