I’ve historically been pretty old-school about my app design. But
I’m finally taking a look into REST. I have to say I really
understand George Baily’s take on the thing, it’s not easy to see the
magic coming in. However, I figure I’ll give it a good shot for a new
project and see if I end up getting it.
That being said, I have a question. What would be the stylistically
correct way to approach something like adding methods to controllers
like GenericController#returnCountOfAllItemsWhereX (Where X could be
all Generics newer than Y, etc) I know the function that gets the
value should be in the model, but historically I would have created a
method in my controller similar to that (ok, not so verbose, but you
know ; ) that retrieved the value from the model and sent it out.
Another question would be if I had an association like Project
(has_many :tasks) and Task(belongs_to :project), how (being
stylistically correct RESTwise) would I go about getting all the Tasks
for a Project from the TasksController (ie, I don’t want to get the
Project then Tasks, but have the Project.id). This make any sense at
I’ve considered that maybe I could create other controllers to handle
those functions, which from my understanding is what I should do, but
everything I’ve thought of in that direction just makes the app more
confusing. This seems very anti-REST (per my understanding).
How would you REST experts handle these types of situation? Anyway,
any help is appreciated, I feel like I’m on the edge of figuring out
something very useful, but some issues like this are in my way. I get
the impression that REST is a lightbulb kind of thing, and until it
lights up it’s just tedious seeming.
P.S. Just because it might help make the 2nd example a little less
crazy, I’m working on a Flex/Cairngorm/RAMF/Rails project. I’m not
returning associations with the Project data.