siphon 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/generators/templates/search.rb +4 -1
- data/lib/siphon/boilerplate.rb +3 -4
- data/lib/siphon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9b86838aae3f13ab3623d7b189a31f090114cfa
|
4
|
+
data.tar.gz: cdf710190096aa2ffacfbd902da5d315306ab1b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6ba1bfa8034b566f0732840e720707d687128ab1b2face86e980616588c26e243ac7d150ad281c8dc60f14c5eaf86ec997d9fe6d9f08f568b603dc2d770e59b
|
7
|
+
data.tar.gz: d60003907e7b8b60377c3c0c8274df899070124e1c87a6101721df4c84b6fd41914bca021e8f6c04147719654a42f591bcad305c1a6cee7ee10e1ace5b641976
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Siphon
|
2
2
|
|
3
|
-
Siphon's a minimalistic gem which enables you to easily and conditionnaly apply your ActiveRecord scopes with parameteres sent through the web.
|
3
|
+
Siphon's a minimalistic gem (for ruby >= 2.0) which enables you to easily and conditionnaly apply your ActiveRecord scopes with parameteres sent through the web.
|
4
4
|
|
5
5
|
|
6
6
|
## Installation
|
@@ -16,7 +16,10 @@ class <%= class_name %>Search
|
|
16
16
|
# ransack :category_id_eq
|
17
17
|
# ransack :title_cont
|
18
18
|
|
19
|
-
|
19
|
+
def initialize(params = {}, relation = nil)
|
20
|
+
super params
|
21
|
+
@relation = relation
|
22
|
+
end
|
20
23
|
|
21
24
|
# Exmaple of Search Form handling order stuff (might not be the best place)
|
22
25
|
def self.order_by
|
data/lib/siphon/boilerplate.rb
CHANGED
@@ -21,8 +21,7 @@ module Siphon
|
|
21
21
|
end
|
22
22
|
|
23
23
|
module InstanceMethods
|
24
|
-
def initialize( params = {}
|
25
|
-
@relation||= relation
|
24
|
+
def initialize( params = {})
|
26
25
|
@params = params || {}
|
27
26
|
|
28
27
|
@params_ransack= @params.slice(*self.class.ransack_set)
|
@@ -52,7 +51,7 @@ module Siphon
|
|
52
51
|
# memoized or it'll break after attributes reconciled
|
53
52
|
def result
|
54
53
|
@result ||= begin
|
55
|
-
relation = @relation.
|
54
|
+
relation = @relation.
|
56
55
|
merge(ransack.result).
|
57
56
|
merge(siphoned)
|
58
57
|
# reconcile all params for the search form (?)
|
@@ -68,6 +67,7 @@ module Siphon
|
|
68
67
|
name = model_name || "#{model}Search"
|
69
68
|
self.model_name= ActiveModel::Name.new(self, nil, name)
|
70
69
|
self.table_name= Asset.table_name
|
70
|
+
@ransack_set ||= []
|
71
71
|
end
|
72
72
|
|
73
73
|
def ransack_set
|
@@ -75,7 +75,6 @@ module Siphon
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def ransack( attr, type= nil )
|
78
|
-
@ransack_set ||= []
|
79
78
|
attribute attr
|
80
79
|
@ransack_set << attr
|
81
80
|
end
|
data/lib/siphon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: siphon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Sistovaris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|