Keep in mind that the reason that we added this feature was to catch exactly what happened with your code. You should probably rename your method to something that does not conflict with a core Merb method. -- Yehuda
On Fri, Nov 28, 2008 at 5:32 AM, Jonathan Conway <[EMAIL PROTECTED]> wrote: > Hi Daniel, > Thanks for replying so fast! Yep, you're right I found that I had some crud > magic in my controllers which was trying to overwrite some of the merb core > methods. > > Thanks for the help! > > Cheers > > Jonathan > > > On Fri, Nov 28, 2008 at 12:23 PM, Daniel N <[EMAIL PROTECTED]> wrote: > >> >> >> On Fri, Nov 28, 2008 at 11:09 PM, Jonathan Conway <[EMAIL PROTECTED]>wrote: >> >>> Hi Guys,I'm currently upgrading a merb app from 0.9.7 to 1.0.3 and >>> whenever I try and start the app up or run a rake task I >>> receive an error if I have a controller who has the same plural name as >>> an existing model e.g comments.rb (controller) and it's associated model >>> comment.rb (model). >>> >>> The error looks like the following: >>> >>> "You tried to define resource on Comments but it was already defined on >>> Merb::Controller. If you meant to override a core method, use override!" >>> >>> Has anyone else come across this problem? >>> >>> Cheers >>> >>> Jonathan >>> >> >> Hi Johnathan, >> >> This is a new feature in merb 1.0.3 controllers where if you try to >> overwrite a core method (ie the merb framework) then an exception will be >> raised. I'm assuming that you're defining a def resource method. This is >> to prevent unintentional behavior. >> >> The method you're clashing with here will be the resource method which is >> used to generate urls for "resources" eg. >> >> resource(@post) #=> /posts/3 >> >> If you really want to over ride the method you can call the override! >> method before declaring it. >> >> eg >> >> override! :resource >> def resource >> # your decleration here >> end >> >> However, it's there to help you identify that you're overwriting a part of >> the framework. Like most things in merb though... you can overwrite it ;) >> >> Cheers >> Daniel >> >> >>> >>> >>> >>> >>> -- >>> --------------------- >>> www.jaikoo.com >>> >>> >>> >> >> >> > > > -- > --------------------- > www.jaikoo.com > > > > -- Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" 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/merb?hl=en -~----------~----~----~----~------~----~------~--~---
