Skip to content

Instantly share code, notes, and snippets.

@randallb
Created December 4, 2012 21:06
Show Gist options
  • Save randallb/4208679 to your computer and use it in GitHub Desktop.
Save randallb/4208679 to your computer and use it in GitHub Desktop.
class Scene < ActiveRecord::Base
has_and_belongs_to_many :buttons
has_many :overlay_buttons
has_many :flag_buttons
has_many :ticker_buttons
has_many :bug_buttons
has_many :background_buttons
has_many :other_buttons
has_many :preset_buttons
has_many :button_groups
has_many :tasks, as: :taskable
accepts_nested_attributes_for :tasks
attr_accessible :name, :tasks_attributes
def as_json(options={})
options[:except] ||= [:created_at, :updated_at]
options[:methods] ||= [:buttons, :overlay_buttons, :flag_buttons,:ticker_buttons,:bug_buttons,:background_buttons,:other_buttons,:preset_buttons]
super options
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment