Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
use tap instead of returning
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Oct 11, 2011
1 parent 46e1883 commit 4e91fdc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/searchify/facets_builder.rb
Expand Up @@ -44,14 +44,14 @@ def associations_hash

def facet_from_column_name(name)
raise "No column found with the name '#{name}' for searchify." if column(name).nil?
returning Facet.new(@model_class, column(name).name, column(name).type, nil, @prefix) do |facet|
Facet.new(@model_class, column(name).name, column(name).type, nil, @prefix).tap do |facet|
@parent_facet.add_child(facet) if @parent_facet
end
end

def facets_from_association(name, arguments)
raise "No association found with the name '#{name}' for searchify." if association_reflection(name).nil?
returning FacetsBuilder.build(association_reflection(name).klass, arguments, name) do |facets|
FacetsBuilder.build(association_reflection(name).klass, arguments, name).tap do |facets|
@parent_facet.add_children(facets) if @parent_facet
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -18,7 +18,7 @@ def self.paginate(options)
end

def self.add_column(name, type = :string)
returning ActiveRecord::ConnectionAdapters::Column.new(name, nil) do |column|
ActiveRecord::ConnectionAdapters::Column.new(name, nil).tap do |column|
column.stubs(:type).returns(type)
@columns ||= []
@columns << column
Expand Down

0 comments on commit 4e91fdc

Please sign in to comment.