Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ansix
Created April 10, 2013 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ansix/5356037 to your computer and use it in GitHub Desktop.
Save ansix/5356037 to your computer and use it in GitHub Desktop.
class Festival < ActiveRecord::Base
attr_accessible :name, :client_id
belongs_to :client
has_many :covers
has_many :photos
def as_json(opts = {})
if !covers.empty?
opts = opts.merge({
:except => [:created_at, :updated_at],
:include => {
:covers => {
:methods => [:image_url, :thumbnail_url],
:except => [:created_at, #:updated_at,
:main_text_block_id, :left_text_bar_id,
:first_left_text_block_id, :second_left_text_block_id, :third_left_text_block_id,
:first_right_text_block_id]
}
}
})
super(opts)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment