Generally, I’ve liked my introduction to RoR, but I’m having some
doubts; I think I may be trying to put a square language into a round
problem.
I’m trying to build a state machine. Each ‘job’ has state, and constant
data throughout all states (well, predictable data, it isn’t used
anywhere, but it is easily modeled with a database record with data
fields and one state field). Jobs have owners, and there is also an
admin. User is determined by REMOTE_USER (using apache auth is far
easier than anything else)
I haven’t seen many examples of people doing RoR this way. My current
plan is to have user and admin controllers, and then model the state
changes as functions in the controllers. Does this seem reasonable?
RoR feels like it’ll save me a lot of time in the long run, but I’m
wondering if this project would be better if written without a
framework. If anyone knows of a tutorial that deals with lots of
external (to rails or the sql database), that’d be appreciated.
Jonathan D. wrote:
Generally, I’ve liked my introduction to RoR, but I’m having some
doubts; I think I may be trying to put a square language into a round
problem.
I’m trying to build a state machine. Each ‘job’ has state, and constant
data throughout all states (well, predictable data, it isn’t used
anywhere, but it is easily modeled with a database record with data
fields and one state field). Jobs have owners, and there is also an
admin. User is determined by REMOTE_USER (using apache auth is far
easier than anything else)
I haven’t seen many examples of people doing RoR this way. My current
plan is to have user and admin controllers, and then model the state
changes as functions in the controllers. Does this seem reasonable?
RoR feels like it’ll save me a lot of time in the long run, but I’m
wondering if this project would be better if written without a
framework. If anyone knows of a tutorial that deals with lots of
external (to rails or the sql database), that’d be appreciated.
I don’t know about using apache auth, but check out
acts_as_state_machine:
http://lunchroom.lunchboxsoftware.com/articles/2006/01/21/acts-as-state-machine
It makes state tracking pretty straight forward and painless.
As for the rest, with records belongs to users, and some users being
admins and some not; this is a well travelled area for Rails. Almost
any site with registered users follows a pattern that is similar to
this.
Jonathan D. wrote:
User is determined by REMOTE_USER (using apache auth is far
easier than anything else)
It will work: you can access it with “request.env[‘REMOTE_USER’]” from
any controller.