expose_query 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: 597d0f67891561a245fef7c26d1a618146bcdff8
4
- data.tar.gz: a890348d0e1739ee478c08fa422e2f3410e950b6
3
+ metadata.gz: 3830e41dbd932f912f2174a3a7530fda54ca641c
4
+ data.tar.gz: d62a10521d46316a6ec22dab2dabf2cc8266df3b
5
5
  SHA512:
6
- metadata.gz: ab26af2998ee8b480f60b1666b6457703b4a0225b8dc2c5c01dd6d25545ca73cd5313f755d064c85753402488914ead71207484449165fbff39cdb9f78d93fe4
7
- data.tar.gz: 34af33525c277cea4ede96b5a2ffe7c0637a46cd0e96f29af8c5b29ec4d56f3d41167c51ba339cb9816a0d89fa7273a2a7786a9b13254a0bb115413df2ea2e16
6
+ metadata.gz: 8b56696c3499018413edc05b43b22bc4ac3239c614a88620245753527a74162a45c4a3452630b13aa73e9c54aa4747769015e8cba3536027b162dafbd792cef6
7
+ data.tar.gz: 0eebdf0ce5b1f4ae5c1c3931f11d81a1e11305975391f9d44ae171604816931abdbb2b4a05617e87f4ef1dfe12f380543c9ccaf689c09a2bd6c49588b827016e
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Code Climate](https://codeclimate.com/github/chubarovNick/expose_query.png)](https://codeclimate.com/github/chubarovNick/expose_query)
2
2
  [![Build Status](https://travis-ci.org/chubarovNick/expose_query.svg?branch=master)](https://travis-ci.org/chubarovNick/expose_query)
3
-
3
+ [![Dependency Status](https://gemnasium.com/chubarovNick/expose_query.svg)](https://gemnasium.com/chubarovNick/expose_query)
4
4
  # ExposeQuery
5
5
 
6
6
  Add query benefit for exposed decent_exsposure values
@@ -14,13 +14,29 @@ And then execute:
14
14
 
15
15
  $ bundle
16
16
 
17
- Or install it yourself as:
18
-
19
- $ gem install expose_query
20
17
 
21
18
  ## Usage
22
19
 
23
- TODO: Write usage instructions here
20
+ Add module to paticular controller:
21
+
22
+ ```
23
+ class PhotosController < ApplicationController
24
+ include ExposeQuery::ControllerDsl
25
+ expose(:photos)
26
+
27
+ expose_query PhotoQuery
28
+ end
29
+ ```
30
+ And define query class:
31
+ ```
32
+ class PhotoQuery < ExposeQuery::BaseQuery
33
+
34
+ def apply source_scope
35
+ source_scope.where(image_processing: [nil, false])
36
+ end
37
+ end
38
+ ```
39
+
24
40
 
25
41
  ## Contributing
26
42
 
@@ -5,7 +5,7 @@ module ExposeQuery
5
5
 
6
6
  included do
7
7
 
8
- cattr_accessor :query_classes
8
+ class_attribute :query_classes
9
9
 
10
10
  def self.expose_query(*filter_classes)
11
11
  self.query_classes = Array.wrap(filter_classes.to_a)
@@ -1,3 +1,3 @@
1
1
  module ExposeQuery
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/expose_query.rb CHANGED
@@ -4,6 +4,9 @@ require 'expose_query/controller_dsl'
4
4
  require 'expose_query/active_record_query_strategy'
5
5
  require 'decent_exposure'
6
6
 
7
+ ActiveSupport.on_load(:action_controller) do
8
+ include ExposeQuery::ControllerDsl
9
+ end
7
10
 
8
11
  DecentExposure::ActiveRecordStrategy.class_eval do
9
12
  include ExposeQuery::ActiveRecordQueryStrategy
@@ -11,8 +11,6 @@ class DummyQuery < ExposeQuery::BaseQuery
11
11
  end
12
12
 
13
13
  class DummyController < ActionController::Base
14
- include ExposeQuery::ControllerDsl
15
- extend DecentExposure::Expose
16
14
  expose(:bird) #{ 'Bird' }
17
15
  expose_query DummyQuery
18
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expose_query
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
  - Nick Chubarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2014-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decent_exposure