Module: DataMapper::Is::List::ClassMethods
- Defined in:
- lib/dm-is-list/is/list.rb
Overview
is_list
Instance Attribute Summary collapse
-
#list_options ⇒ Object
readonly
Returns the value of attribute list_options.
Instance Method Summary collapse
-
#repair_list(scope = {}) ⇒ Object
use this function to repair / build your lists.
Instance Attribute Details
#list_options ⇒ Object (readonly)
Returns the value of attribute list_options.
304 305 306 |
# File 'lib/dm-is-list/is/list.rb', line 304 def @list_options end |
Instance Method Details
#repair_list(scope = {}) ⇒ Object
use this function to repair / build your lists.
316 317 318 319 320 321 322 323 |
# File 'lib/dm-is-list/is/list.rb', line 316 def repair_list(scope = {}) return false unless scope.keys.all?{ |s| [:scope].include?(s) || s == :order } retval = true all({ :order => [ :position.asc ] | default_order }.merge(scope)).each_with_index do |item, index| retval &= item.update(:position => index.succ) end retval end |