sortability 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbdc9e49977965ce964ed77b4c14f31c1a8c771e2a46691a7328b862b653846b
4
- data.tar.gz: 8af55ed58e116a9adb941e2e4d0fc87fc530bce25ea5c49d3eca1f66b536dd5a
3
+ metadata.gz: e811a6edc06dbfee9c4432f0b81eec7a36aec4cf07e40e5604f397f84a62007f
4
+ data.tar.gz: 172646fbe4de26f3def8354d671378a9fc5d6faea2b95757d0973c06c6e9de43
5
5
  SHA512:
6
- metadata.gz: 59b9f1de09e97914319f9e5ffff0db36c74227e8d67cac491fbeb9e48f866eb09df5a330b1b781a9b8d5eb3f652a70410d17d76e5dd792dc958a9820f5963e10
7
- data.tar.gz: 21e9610b6552387393948733057f37526242282ee98a8617820be01065cf65b127db2670e1bf9800889cb74b9ad259fadbdc821ac455d304bef7149077f6c8c1
6
+ metadata.gz: 6844492fe3c495616404aa9cf5edcda32fd8082d6c3a515f706e2b64710a9e8cc459c5845647d26ab8b9f65599af332bc56c085f0cae670072fddd8293cdfadb
7
+ data.tar.gz: 118dd54f18ad0de05bab919d8f65dddeb0de04861fdb1b3be819ca57fce7b4b00a71531e407f3c37299ca19a293154d497c752293c7ba8093144be1a4f98f67e
@@ -126,24 +126,24 @@ module Sortability
126
126
  end
127
127
 
128
128
  # Defines a sortable has_many relation on the container
129
- def sortable_has_many(records, scope_or_options = nil, options_with_scope = {}, &extension)
130
- scope, options = extract_association_params(scope_or_options, options_with_scope)
129
+ def sortable_has_many(records, scope_or_options = nil, **remaining_options, &extension)
130
+ scope, options = extract_association_params(scope_or_options, remaining_options)
131
131
  if scope.nil?
132
132
  on = options[:on] || :sort_position
133
133
  scope = -> { order(on) }
134
134
  end
135
135
 
136
- class_exec { has_many records, scope, options.except(:on), &extension }
136
+ class_exec { has_many records, scope, **options.except(:on), &extension }
137
137
  end
138
138
 
139
139
  # Defines a sortable belongs_to relation on the child records
140
140
  def sortable_belongs_to(container, scope_or_options = nil,
141
- options_with_scope = {}, &extension)
142
- scope, options = extract_association_params(scope_or_options, options_with_scope)
141
+ **remaining_options, &extension)
142
+ scope, options = extract_association_params(scope_or_options, remaining_options)
143
143
  on = options[:on] || :sort_position
144
144
 
145
145
  class_exec do
146
- belongs_to container, scope, options.except(:on, :scope), &extension
146
+ belongs_to container, scope, **options.except(:on, :scope), &extension
147
147
 
148
148
  reflection = reflect_on_association(container)
149
149
  options[:scope] ||= reflection.polymorphic? ? \
@@ -181,11 +181,11 @@ module Sortability
181
181
 
182
182
  protected
183
183
 
184
- def extract_association_params(scope_or_options, options_with_scope)
184
+ def extract_association_params(scope_or_options, remaining_options)
185
185
  if scope_or_options.is_a?(Hash)
186
- [nil, scope_or_options]
186
+ [nil, scope_or_options.merge(remaining_options)]
187
187
  else
188
- [scope_or_options, options_with_scope]
188
+ [scope_or_options, remaining_options]
189
189
  end
190
190
  end
191
191
  end
@@ -1,3 +1,3 @@
1
1
  module Sortability
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
Binary file