mongoid_sortable_relation 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 5144c72787dd508a0ddd1a49f478593a66c92b39
4
- data.tar.gz: 81de308a09f12eb682cdb81457462fe52ff059df
3
+ metadata.gz: 5312af9141d4bac176074e424c83d3a5a1a4bfcd
4
+ data.tar.gz: c72b73b46b2ac74417671aa1c2bcece9507f66f8
5
5
  SHA512:
6
- metadata.gz: 441212e1c423179ac02c30e7e20b949564fe5d690713bbfbf7159178f11516a2744b409ede9439ec0db486dd806983c836b010e8f68ec76cee421c26ff84f8af
7
- data.tar.gz: ca0fc12e9f6045a6b1aaba762e6e1899298fbd6670f54d1e3a7cb7e77b1379e0e980b047f6f0817307f5af25b5df5f5e1fe05c055961e7d226c17a122191ee2e
6
+ metadata.gz: 3396d635e7279f419ba7f84b31f6959ee237bb37b3b6250aab0c2f961fe76db7bb0c0a076d24df6a9815987289ac36ab508aece191965298eb56decdbd02028d
7
+ data.tar.gz: 1e4bf22e53ba33efc9e59a007e0875288e46beca77f2eac9aeb6218b92674a76a14e7f02231b298b6e3a3e1239f06bfad4cd6a2550cd8c6a70a3b8931bfde255
@@ -2,14 +2,18 @@ require 'rails'
2
2
  require 'mongoid'
3
3
  require 'mongoid_criteria_filter'
4
4
 
5
- require 'mongoid_sortable_relation/referenced/many'
6
- require 'mongoid_sortable_relation/referenced/many_to_many'
7
- require 'mongoid_sortable_relation/findable'
8
- require 'mongoid_sortable_relation/macros'
9
- require 'mongoid_sortable_relation/many'
10
- require 'mongoid_sortable_relation/many_to_many'
5
+ # many
6
+ require 'mongoid_sortable_relation/many/referenced'
7
+ require 'mongoid_sortable_relation/many/findable'
8
+ require 'mongoid_sortable_relation/many/macros'
9
+ require 'mongoid_sortable_relation/many/builder'
10
+ require 'mongoid_sortable_relation/many/origin_optional'
11
+
12
+ # many to many
13
+ require 'mongoid_sortable_relation/many_to_many/referenced'
14
+ require 'mongoid_sortable_relation/many_to_many/builder'
15
+
11
16
  require 'mongoid_sortable_relation/metadata'
12
- require 'mongoid_sortable_relation/origin_optional'
13
17
 
14
18
  module MongoidSortableRelation
15
19
 
@@ -10,7 +10,7 @@ module Mongoid
10
10
 
11
11
  def reference(metadata, type = Object)
12
12
  original_reference(metadata, type)
13
- if metadata.sortable?
13
+ if metadata.sortable? and metadata.relation == Mongoid::Relations::Referenced::Many
14
14
  to_class = metadata.class_name.classify.constantize
15
15
  to_class.field metadata.sortable_field, :type => Integer
16
16
  to_class.scope metadata.sortable_scope, -> { prepend_order_by(metadata.sortable_field => :asc) }
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+ module MongoidSortableRelation
3
+ VERSION = '0.0.3'
4
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_sortable_relation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Melanitskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-02 00:00:00.000000000 Z
11
+ date: 2014-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -60,14 +60,15 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - lib/mongoid_sortable_relation.rb
63
- - lib/mongoid_sortable_relation/findable.rb
64
- - lib/mongoid_sortable_relation/macros.rb
65
- - lib/mongoid_sortable_relation/many.rb
66
- - lib/mongoid_sortable_relation/many_to_many.rb
63
+ - lib/mongoid_sortable_relation/many/builder.rb
64
+ - lib/mongoid_sortable_relation/many/findable.rb
65
+ - lib/mongoid_sortable_relation/many/macros.rb
66
+ - lib/mongoid_sortable_relation/many/origin_optional.rb
67
+ - lib/mongoid_sortable_relation/many/referenced.rb
68
+ - lib/mongoid_sortable_relation/many_to_many/builder.rb
69
+ - lib/mongoid_sortable_relation/many_to_many/referenced.rb
67
70
  - lib/mongoid_sortable_relation/metadata.rb
68
- - lib/mongoid_sortable_relation/origin_optional.rb
69
- - lib/mongoid_sortable_relation/referenced/many.rb
70
- - lib/mongoid_sortable_relation/referenced/many_to_many.rb
71
+ - lib/mongoid_sortable_relation/version.rb
71
72
  homepage: https://github.com/Rademade/mongoid_sortable_relation
72
73
  licenses:
73
74
  - MIT