Topic: "Service" a reserved word?

I had an app I built a few months ago up and running. I downloaded the app to my computer so that I could add some changes.

It would run but for some reason I kept getting an error that said there was no method 'table_name' for the Service Module.

I have a model named Service, and after I tried everything else I changed the name of the model from Service to Task. This fixed the problem.

The service model works fine on the online version of the app that's been running for several months. I am also not using any pluggins.

So has something changed in rails 1.23 so that "Service" can't be used as a model name?

Last edited by learc83 (2007-05-15 23:42:21)

Re: "Service" a reserved word?

interesting, AFAIK it's not a reserved word and it doesn't show up in any list I've seen. Try launching script/console for the app and typing "Service" in there, see if it says it's an initialized constant or not.

Railscasts - Free Ruby on Rails Screencasts

Re: "Service" a reserved word?

I also had the same problem and so much of struggles and time this is what i found.

I guess you are using mongrel ?

Actually if you use WebRICK instead of Mongrel, things should work.
'script/server webrick' [Force WEBrick]

If you still want to use mongrel, what i found is i had this gem installed
"mongrel_service version 0.3.1" in my system.

I Uninstalled the above gem. Now i just have this gem in my system "mongrel (1.0.1)"

and now i restarted my apps and it is working fine. !!!

I guess the 'service' in "mongrel_service version 0.3.1" is classing with our 'app service.'

Hope it helps.

Thanks
Dinesh

Re: "Service" a reserved word?

Awesome, I was wondering what was causing that.

Re: "Service" a reserved word?

So did it solve your problem, did u get a chance to try out the steps in my earlier post ? just curios to know is that the reason ?

Re: "Service" a reserved word?

I can't be sure if that was the issue or not b/c I'd already renamed the model to something else.
But I'm pretty sure it was b/c I was running mongrel on my machine and that was the only difference between the online version which was working and the local version that wasn't.

Re: "Service" a reserved word?

I'm having this problem with Mongrel and Webrick. I have a model called Service, belonging to another model through a Hub. hub.service.inspect shows everthing correctly, but when I for instance try a hub.service.title it gives me an "error occurred while evaluating nil.title".