Created
September 1, 2011 09:47
-
-
Save marclipovsky/1185839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Category < ActiveRecord::Base | |
has_many :tickets | |
has_many :tasks, :dependent => :destroy | |
accepts_nested_attributes_for :tasks, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true | |
acts_as_tree | |
has_friendly_id :name, :use_slug => true | |
scope :parent, where({:parent_id => nil}, {}) | |
scope :children, where({'parent_id > ?', 0}, {}) | |
end | |
class Tasks < ActiveRecord::Base | |
belongs_to :category | |
belongs_to :ticket | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment