Rails Software As A Service Plugin

The purpose of this project is to provide a set of drop in plugins to turn your existing Ruby on Rails application into a "software as a service."

What the hell does that mean?

According to my definition a software as a service application should:

Why should I use it?

Where do I start

acts_as_scoped - Limits the scope of your finds automagically. This is perfect for the first scenario, you' writing an app and you don't want to write this all the time:


    def index
      @items = Item.find(:all, :conditions => { :account_id = session[:account_id] })
    ...
    def create
      params[:item][:account_id] = session[:account_id]
      @item = Item.create(params[:item])
    ...
    def destroy
      Item.destroy(params[:id], :conditions => { :account_id = session[:account_id] })
    ...
  

It's also good in the second case, when you've already got the following:


    def index
      @items = Item.find(:all)
    ...
    def create
      @item = Item.create(params[:item])
    ...
    def destroy
      Item.destroy(params[:id])
    ...
  

Here's the best part, using the acts_as_scoped plugin you get to either write or keep the later

limit_by_scope - Enforces a quota limit on creating new objects. This is great to create plans or tiers for your accounts then ensure your accounts can only create up to what their plan includes. Again, you could do this.


    def create
      plan = Account.find(session[:account_id]).plan
      if Item.count(:conditions => { :account_id => session[:account_id] }) < plan.item_limit
        @item = Item.create(params[:item])
      else
        flash[:fatal] = "Sorry, your plan only supports #{pluralize(plan.item_limit, 'item')}, please upgrade your account from the  'account', :action => 'my')}\">preferences page."
    ...
  

Or you could do this:


    def create
      @item = Item.create(params[:item])
    ...
  

So what about that international time zone bullet?

Ok, so that one isn' out yet. This documentation is a work in progress so it'll get better real soon. In the mean time hit the rdoc for acts_as_scoped and limit_by_scope or hit the project page on RubyForge.


Oh, yeah about me acts_as_flinn... I'm Flinn Mueller I wrote these plugins during the course of developing my company's inventory management software as a service.