So are you using REST? if yes for which situations do you think the REST approach works the best?
what you are waiting for is exactly what I am looking for Luke!Originally Posted by Luke Redpath
REST doesn't seem to be that popular...does it?
RPC is definitely more popular then REST, though I do believe that REST was gaining popularity before it was made an option in Rails 1.2. If i'm not mistaken .NET supported it, faking HTTP's DELETE and PUT as well (Heard it during David Hansson's Rails keynote, someone mentioned .NET's implementation and how bad it's faking was.). Amazon's S3 also offers a REST interface, though that really wasn't the question.
I can think of many applications where REST works really well, but not of applications where it wouldn't work (applications that you'd use Rails for, not an online calculator for example). Does anyone have examples of applications where REST doesn't work?
I like the concept of "simplify everything down to CRUD". I'm not 100% sold on the idea of having a REST API for every part of your webapp, but I also see it as of minor importance I guess.
Yes! Do you think it's a good idea to create a REST layer, and on top of that the actual application for the user? The workflow can be done by the topmost application, and you still have a REST API beneath that. You can then expose these APIs for users who want to create another front-end.Originally Posted by Luke Redpath
Well, whatever front end you have, it *must* interface with the workflow.
The important thing to remember about a workflow is that whilst it looks similar to a controller (i.e. it deals with the logic of where to go next) its actually part of the domain model. Any controller should simply delegate to the workflow to find out where to go next, then issue the redirect.
You could conceivelbly CRUD a Workflow object, updating the workflow with any important data, I suppose.
Code:class WorkflowController < ActionController::Base before_filter :load_workflow, :except => [:new] after_filter :persist_workflow, :except => [:update, :delete] def new @workflow = Workflow.new end def show redirect_to :action => 'new' if @workflow.nil? and return @workflow.invoke(params[:step]) render :template => params[:step] end def update @workflow.update(some_data) if @workflow.complete? redirect_to :action => 'destroy' and return end redirect_to :action => 'show, :step => @workflow.next_step end def destroy @workflow.destroy end protected def persist_workflow @workflow.save session[:workflow_id] = @workflow.id end def load_workflow @workflow = Workflow.find(session[:workflow_id]) end end