sequenceable 0.1.2 → 0.1.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
  SHA256:
3
- metadata.gz: fad13251da26debcf90f7612cae3e0c593cf5c32d9d435190df19bcdfe4edfd8
4
- data.tar.gz: ba5fe3bd0efac35c948122c74c85ad1ac510f7e0b64b9dfaa207c116ecf46c6f
3
+ metadata.gz: 0ac6fb7cbe7d47efc0c969a58a34a9c1141753dc94f5e230443d806f5db6212e
4
+ data.tar.gz: 14ce197c4708777135a3e1b01730547a0f8535eb34566795100d379a18c6a8e7
5
5
  SHA512:
6
- metadata.gz: 71ce260049756a26fe4b22cb041e733aef1d60c6c2e0696a2af4d4ec6ab7bb5aa25eb10b82c5b2b2275f919ad984b82d85f7bb52f4c996ed5a0b2599f3372bfa
7
- data.tar.gz: 1b38229378511685554122db9121736edf766ef4ee2a0fd095ea585464071148e1ecb39b583b69a9095ae45272a05fc9f1b61e9be325c1b64f5f0df5ef365d36
6
+ metadata.gz: 36d603044b0f2cb188710692b5ea6fa277bb8041779ffa23a8b95d87322a6603b44963effeb34ab1c20d503b0c206ef4258b481d73f18ae62df632b1b777176b
7
+ data.tar.gz: c0a63afad9167f8b73fe8d93a16700b8a99016bbe1aa102b0e40f1a9c3e6dc09e7911bb9f94523121ea7919f89ffa77baf97ad6c46f8d66d8004476a9d7b3ce3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sequenceable (0.1.1)
4
+ sequenceable (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Sequenceable
2
2
 
3
- [![sandip-mane](https://circleci.com/gh/sandip-mane/sequenceable.svg?style=svg)](https://app.circleci.com/pipelines/github/sandip-mane/sequenceable?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/sequenceable.svg)](https://badge.fury.io/rb/sequenceable)
4
+ [![sandip-mane](https://circleci.com/gh/sandip-mane/sequenceable.svg?style=shield)](https://app.circleci.com/pipelines/github/sandip-mane/sequenceable?branch=master)
4
5
 
5
6
  Adds sequencing abilities to the ActiveRecord Models.
6
7
  This gem can be useful in managing `sequence` of the records in the database.
@@ -50,6 +51,14 @@ class Task < ActiveRecord::Base
50
51
  end
51
52
  ```
52
53
 
54
+ You can scope on any column ( Yeah, thats right! )
55
+
56
+ ```ruby
57
+ class Task < ActiveRecord::Base
58
+ acts_in_sequence scope :name
59
+ end
60
+ ```
61
+
53
62
  #### :column_name
54
63
  With `:column_name` we can use custom column names instead of using `sequence`.
55
64
 
@@ -15,8 +15,7 @@ module Sequenceable
15
15
  for_name = sequencing_configuration[:scope]
16
16
  return self.class if for_name.blank?
17
17
 
18
- for_assoc = self.class.reflect_on_all_associations(:belongs_to).find { |x| x.name == for_name }
19
- self.class.where(for_assoc.foreign_key => self[for_assoc.foreign_key])
18
+ self.class.where(for_name => self.send(for_name))
20
19
  end
21
20
  end
22
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sequenceable
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequenceable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandip Mane