Gavin Kistner
3/26/2007 10:25:00 PM
On Mar 26, 4:22 pm, Joshua Muheim <f...@josh.ch> wrote:
> Thanks a lot, guys!
>
> I got another problem now:
>
> private
> def model_obj_name
> CountriesController.controller_class_name.underscore.sub(/_controller$/,
> '').singularize
> end
>
> def model_obj=(obj)
> self.model_obj_name
> end
>
> This gives me the following error:
>
> private method `model_obj_name' called for
> #<CountriesController:0x23e3f20>
>
> Why that? I *can* call private methods within the methods of the same
> object, can't I?!
Yes, but you can't call them with an explicit receiver. Try simply:
def model_obj=( obj )
model_obj_name
end