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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff59f1ee65f4df1a1dcd5a81d58f720516661b04
4
- data.tar.gz: b8de584c9cc38381f08ff3728010465aab98ad61
3
+ metadata.gz: c9b86838aae3f13ab3623d7b189a31f090114cfa
4
+ data.tar.gz: cdf710190096aa2ffacfbd902da5d315306ab1b0
5
5
  SHA512:
6
- metadata.gz: 976bb2d950083963335c855b4b7848eb84689094245eafb76c23d0e61fc5ea201ed1ca0b5da71b66f04af1a792ec73938c23ca7c22eef02f707f056a0979338b
7
- data.tar.gz: e4b25e4bbe4844db09024f2e61939583f89d6e1daee028162c24740a614972d255703891aacd43a0604f5f5688599362adcaa75e68eb5fe6b4fd93906ccd495d
6
+ metadata.gz: a6ba1bfa8034b566f0732840e720707d687128ab1b2face86e980616588c26e243ac7d150ad281c8dc60f14c5eaf86ec997d9fe6d9f08f568b603dc2d770e59b
7
+ data.tar.gz: d60003907e7b8b60377c3c0c8274df899070124e1c87a6101721df4c84b6fd41914bca021e8f6c04147719654a42f591bcad305c1a6cee7ee10e1ace5b641976
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
4
3
  - "2.0.0"
5
4
  - "2.2.3"
6
5
  #- jruby-18mode # JRuby in 1.8 mode
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Siphon 0.2.1 (Dec 2015)
2
+
3
+ * Boilerplate only sets params (relation is left to the user)
4
+ * Search#order_by isn't called in result (left to user as well )
5
+
1
6
  ## Siphon 0.2.0 (Dec 2015)
2
7
 
3
8
  * The ModelSearch can now respond_to `siphon_attributes`
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
@@ -21,8 +21,7 @@ module Siphon
21
21
  end
22
22
 
23
23
  module InstanceMethods
24
- def initialize( params = {}, relation = nil )
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.order(order_by).
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
@@ -1,3 +1,3 @@
1
1
  module Siphon
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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-09 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport