Skip to content

Commit

Permalink
Merge pull request #1 from daniel-sullivan/fix-for-conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sullivan authored Aug 9, 2017
2 parents 8ecab17 + c5fdc93 commit 3170053
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/jsonapi/serializable/resource/conditional_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ def self.prepended(klass)
end

def self.extended(klass)
klass.class_eval do
include InstanceMethods
klass.module_eval do
prepend InstanceMethods

class << self
attr_accessor :field_condition_blocks
attr_accessor :link_condition_blocks
end
self.field_condition_blocks ||= {}
self.link_condition_blocks ||= {}

end
end

Expand All @@ -49,6 +51,8 @@ def attribute(name, options = {}, &block)
_register_condition(field_condition_blocks, name, options)
end



# Handle the `if` and `unless` options for relationships (has_one,
# belongs_to, has_many).
#
Expand Down

0 comments on commit 3170053

Please sign in to comment.