kovacs / sortable

Rails plugin to produce a sortable, paginated, searchable table for any model. Licensed with the same MIT license as rails
http://www.cablecarsoftware.com
39 stars 10 forks source link

LoadError in 1.9, generator.rb gone #1

Open philomory opened 14 years ago

philomory commented 14 years ago

generator.rb has been removed from Ruby 1.9, so when trying to use sortable under 1.9, it fails with a LoadError. sortable.rb isn't really making much use of Generator's features, though, so the patch to fix the issue is pretty simple.

0a1,2
> require 'generator'
> 
211c213,214
<           search_array.each_with_index do |col,i|

---
>           g = Generator.new(search_array)
>           g.each do |col|
213c216
<            columns_to_search += 'OR ' unless i == search_array.length - 1

---
>            columns_to_search += 'OR ' unless g.end?
259c262,263
<           sort_array.each_with_index do |sort_value,i|

---
>           g = Generator.new(sort_array)
>           g.each do |sort_value|
261c265
<             result += ', ' unless i == sort_array.length - 1

---
>             result += ', ' unless g.end?
kovacs commented 13 years ago

Hey sorry I haven't been monitoring this.. I'll go ahead and apply this patch.. appreciate it