My favorites | Sign in
Project Logo
                
Code license: MIT License
Labels: acts_as_taskable, rails, ruby, plugin

Acts as Taskable is a Rails plugin that allows any ActiveRecord class to automatically accept tasks

Install

  def self.up
    create_table "tasks", :force => true do |t|
      t.column "title", :string, :limit => 150, :default => ""
      t.column "description", :text, :default => ""
      t.column "created_at", :datetime, :null => false
	  t.column "due_by",	 :datetime
	  t.column "completed",  :boolean, :null => false, :default => false
      t.column "taskable_id", :integer, :default => 0, :null => false
      t.column "taskable_type", :string, :limit => 25, :default => "", :null => false
      t.column "assigned_to", :integer, :default => 0, :null => false
    end
  
    add_index "tasks", ["assigned_to"], :name => "fk_tasks_user"
  end

  def self.down
	drop_index "fk_tasks_user"
    drop_table :tasks
  end
 

Usage

 model = Model.new
 task = Task.new
 task.title = 'Kill bill'
 task.due_bye = Time.now.next_week
 task.user_id = @user.id   # The id of any specific user.
 model.tasks << task

 model.tasks     # Yes! It is AS easy as that

Credits

Juixe Software - Shamelessly copied from the Acts as Commentable plugin









Hosted by Google Code