Hi,
I just started with rails, and thought it made sense to go with 2.0 (
know this isn’t necessarily a majority opinion
I have an application which will potentially be used for a number of
towns, each one of which might be quite different. I’m just working on
one, ‘mytown’, for now.
Each town has it’s own admin section.
So urls look like http://domain/Mytown/[rest stuff] or
http://domain/Mytown/admin/[rest stuff]
The top level (non-admin) bit is currently working ok, on mainly static
files (just using some partials, layouts etc). I haven’t attempted
anything really dynamic yet.
The simplest part of the admin section just manages a list of surnames.
So, for the admin section, I used:
ruby script/generate scaffold mytown::admin::surnames surname:string
prefix:string
http://localhost:3000/mytown/admin/surnames gets routed to the
Mytown::Admin::SurnamesController ok, but throws an error:
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil./
on the line
@mytown/admin_surnames = Mytown::Admin::Surnames.find(:all)
The problem seems to be the slash in the variable name. If I change
this, of course I then get ‘no such variable’ type errors all down the
line.
So, my question is: am I trying to do something I really shouldn’t be
with this kind of nesting, or should I carry on just manually changing
stuff bit by bit till it works? I’ve been following the second approach
so far, but it does feel like rails is something you have to fight at
every step, which is surely a sign that I’m going badly wrong somewhere.
Anyone?
Thanks
Graham