Skip to content

Commit

Permalink
fix action dispatch router - making it backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanRada committed Jun 20, 2016
1 parent a3f3f05 commit 06106ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/washout_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/hash/keys'
require 'active_support/concern'
require 'method_source'
require 'active_support/core_ext/string/output_safety.rb'

Gem.find_files('washout_builder/**/*.rb').each { |path| require path }
Expand All @@ -11,9 +12,14 @@
alias_method :original_wash_out, :wash_out
# Adds the routes for a SOAP endpoint at +controller+.
def wash_out(controller_name, options={})
options = options.symbolize_keys if options.is_a?(Hash)
if @scope
scope_frame = @scope.respond_to?(:frame) ? @scope.frame : @scope
options.each { |key, value| scope_frame[key] = value }
scope_frame[:module] = scope_frame[:module].blank? ? nil : scope_frame[:module].to_s.underscore
if self.class.instance_method(:original_wash_out).source.to_s.include?("scope_frame[:module]")
options.delete(:module) if options.has_key?(:module) # prevent setting the module again in original_wash_out since scope already has it
end
controller_class_name = [scope_frame[:module], controller_name].compact.join("/").underscore
else
controller_class_name = controller_name.to_s.underscore
Expand All @@ -24,10 +30,9 @@ def wash_out(controller_name, options={})
format: false,
as: "#{controller_class_name}_soap_doc"

original_wash_out(controller_name, options)
original_wash_out(controller_name, options)
end
end

# finds all the exception class and extends them by including the ExceptionModel module in order to be
# able to generate documentation for exceptions
WashoutBuilder::Type.all_fault_classes.each do |exception_class|
Expand Down
1 change: 1 addition & 0 deletions washout_builder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.add_runtime_dependency 'wash_out', '>= 0.9.1', '>= 0.9.1'
s.add_runtime_dependency 'activesupport', '>= 4.0', '>= 4.0'
s.add_runtime_dependency 'method_source', '~> 0.8', '>= 0.8.2'

s.add_development_dependency 'wasabi', '~> 3.5', '>= 3.5'
s.add_development_dependency 'savon', '~> 2.11', '>= 2.11'
Expand Down

0 comments on commit 06106ae

Please sign in to comment.