Method: ActiveRecordFlorder::Models#florder
- Defined in:
- lib/active_record_florder/models.rb
#florder(type, opts = {}) ⇒ Object
Initialize ActiveRecordFlorder with given options
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_record_florder/models.rb', line 10 def florder(type, opts = {}) # require type fail ActiveRecordFlorder::Error, 'Define florder type :asc/:desc' unless [:asc, :desc].include?(type) # setup configuration var @florder_config = {} @florder_config[:type] = type.to_sym # add opts to config opts.each do |key, value| @florder_config[key.to_sym] = value end # include florder mixin include ActiveRecordFlorder::Base end |