diff --git a/Gemfile b/Gemfile index a5aee62c2..58ccbc011 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem 'rubyzip' gem 'delayed_job_active_record'#, :group => :production gem 'daemons' gem 'grape', '~> 0.9.0' -gem 'grape-entity' +gem 'grape-entity', '= 0.4.5' gem 'rack-cors', :require => 'rack/cors' gem 'seems_rateable', '~> 1.0.13' gem 'rails', '~> 3.2' diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index bfcca135b..ff3d8de83 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -175,42 +175,3 @@ module ActionController end end end - -module Grape - class Entity - def self.expose(*args, &block) - options = merge_options(args.last.is_a?(Hash) ? args.pop : {}) - - if args.size > 1 - fail ArgumentError, 'You may not use the :as option on multi-attribute exposures.' if options[:as] - fail ArgumentError, 'You may not use block-setting on multi-attribute exposures.' if block_given? - end - - fail ArgumentError, 'You may not use block-setting when also using format_with' if block_given? && options[:format_with].respond_to?(:call) - - options[:proc] = block if block_given? && block.parameters.any? - - @nested_attributes ||= [] - - args.each do |attribute| - unless @nested_attributes.empty? - orig_attribute = attribute.to_sym - attribute = "#{@nested_attributes.last}__#{attribute}" - nested_attribute_names_hash[attribute.to_sym] = orig_attribute - options[:nested] = true - nested_exposures_hash[@nested_attributes.last.to_sym] ||= {} - nested_exposures_hash[@nested_attributes.last.to_sym][attribute.to_sym] = options - end - - exposures[attribute.to_sym] = options - - # Nested exposures are given in a block with no parameters. - if block_given? && block.parameters.empty? - @nested_attributes << attribute - block.call - @nested_attributes.pop - end - end - end - end -end \ No newline at end of file