diff options
| author | Teddy Wing | 2017-09-01 16:51:02 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-09-01 17:22:47 +0200 | 
| commit | df64a6dcbc38cefe41c74bcb1d2d166d13711b23 (patch) | |
| tree | f5f047eb968cc4a7c3d5e3fc4b0ce15f2717f22e | |
| parent | e115d2cf86c285f66af37aa8ca66d63eb4144294 (diff) | |
| download | chouette-core-df64a6dcbc38cefe41c74bcb1d2d166d13711b23.tar.bz2 | |
Revert "TableBuilderHelper::Column#link_to: Allow arbitrary number of arguments"
This reverts commit 28db706443a912e8355e4c48488dc40c403e7f76.
Turns out we didn't need to be able to pass an arbitrary number of
arguments to the lambda after all. The URL helper objects necessary in
addition to the first argument to the lambda can be retrieved from the
view context directly instead of passing them into the block as
parameters (which would actually make things more difficult, because the
block is called in the `TableBuilderHelper`, thus outside the scope of
the view).
| -rw-r--r-- | app/helpers/table_builder_helper/column.rb | 4 | ||||
| -rw-r--r-- | spec/helpers/table_builder_helper/column_spec.rb | 14 | 
2 files changed, 2 insertions, 16 deletions
| diff --git a/app/helpers/table_builder_helper/column.rb b/app/helpers/table_builder_helper/column.rb index 5834cbc4e..b4c569882 100644 --- a/app/helpers/table_builder_helper/column.rb +++ b/app/helpers/table_builder_helper/column.rb @@ -35,8 +35,8 @@ module TableBuilderHelper        !@link_to.nil?      end -    def link_to(*objs) -      @link_to.call(*objs) +    def link_to(obj) +      @link_to.call(obj)      end    end diff --git a/spec/helpers/table_builder_helper/column_spec.rb b/spec/helpers/table_builder_helper/column_spec.rb index 1366d8c46..e0bfd8a6a 100644 --- a/spec/helpers/table_builder_helper/column_spec.rb +++ b/spec/helpers/table_builder_helper/column_spec.rb @@ -58,19 +58,5 @@ describe TableBuilderHelper::Column do          ).link_to(train)        ).to eq('TGV')      end - -    it "takes any number of arguments" do -      train = double('train', kind: 'Shinkansen') - -      expect( -        TableBuilderHelper::Column.new( -          name: 'unused', -          attribute: nil, -          link_to: lambda do |prefix, train| -            "#{prefix}: #{train.kind}" -          end -        ).link_to('Type', train) -      ).to eq('Type: Shinkansen') -    end    end  end | 
