rao-query 0.0.47.pre → 0.0.49.pre

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: 81f699845aeb97d1db2a7e32ef6fc17a8fbe421badff2818550ccabb3c5d064e
4
- data.tar.gz: 99f9745ef5fcf83d324da0059edd7bdc91eedb501488d5e1942282f7e622ee58
3
+ metadata.gz: caa1108b2190909256712d1c97cfe7fa5d5383ac39ece955225612db16e53ea3
4
+ data.tar.gz: f69148a47ce87ae69952ca896ba0b0b7a3dee8f5075ed6b2dc7e72bc65013872
5
5
  SHA512:
6
- metadata.gz: c84ee73666abc81c323d4805aab95500a0fb44fc16ae32f4d414c4f4243dc8345a12f4a1e8baa1d1d0848a540fcaf1552f9b4152a1b7b3546f906d0751f0297a
7
- data.tar.gz: ec227eda3230a83efeb19c22a372bd56e2647180a77dc2cddef8e743e49be3f911ed3c85d89c2d8735f0fd5ef828ff2b6e95b0c31edaff14bfdf0f0b9701068a
6
+ metadata.gz: 5de6981ceafb1a92e5525a34cf489607aef446f5c537a010ba33d2eeb482c1c3b42ad99381d78609c2c57cc3926b0d6797cafd0a5d9e0932557790748b04dab8
7
+ data.tar.gz: b5a87d1251a4f8e2c6557ad13920f84f88f89e15309ad99b73a53c36bd52f3e5e6e5a6062247a441e43cae05ed19108b4da5a023e480425c15d5747e914bcf01
data/README.md CHANGED
@@ -1,10 +1,54 @@
1
1
  # Rails Add-Ons Query
2
- Short description and motivation.
3
2
 
4
- ## Usage
5
- How to use my plugin.
3
+ Provides filtering and sorting of collections at controller level. Useful for
4
+ UIs or APIs that display any collection of records.
5
+
6
+ ## Basic Usage
7
+
8
+ Include the concern in your controller and change you index action to use
9
+ conditions coming from the query string:
10
+
11
+ # app/controllers/posts_controller.rb
12
+ class PostsController < ApplicationController
13
+ include Rao::Query::Controller::QueryConcern
14
+
15
+ def index
16
+ @posts = with_conditions_from_query(Post).all
17
+ end
18
+ end
19
+
20
+ ### Using limit
21
+
22
+ ### Using offset
23
+
24
+ ### Using order
25
+
26
+ ### Using includes
27
+
28
+ The includes parameter is used to eager load associations.
29
+
30
+ #### has many
31
+
32
+ Assume you have posts that have many comments. You can have the comments
33
+ included in your query like this:
34
+
35
+ http://localhost:3000/posts?includes[]=comments
36
+
37
+ ## Usage with rao-api-resources_controller
38
+
39
+ rao-api_resources_controller comes with support for rao-query. You just have
40
+ to include the QueryConcern to enable it. There is no need to overwrite the
41
+ index action:
42
+
43
+ # app/controllers/posts_controller.rb
44
+ class PostsController < Rao::Api::ResourcesController::Base
45
+ include Rao::Query::Controller::QueryConcern
46
+
47
+ #...
48
+ end
6
49
 
7
50
  ## Installation
51
+
8
52
  Add this line to your application's Gemfile:
9
53
 
10
54
  ```ruby
@@ -12,17 +56,21 @@ gem 'rao-query'
12
56
  ```
13
57
 
14
58
  And then execute:
59
+
15
60
  ```bash
16
61
  $ bundle
17
62
  ```
18
63
 
19
64
  Or install it yourself as:
65
+
20
66
  ```bash
21
67
  $ gem install rao-query
22
68
  ```
23
69
 
24
70
  ## Contributing
71
+
25
72
  Contribution directions go here.
26
73
 
27
74
  ## License
75
+
28
76
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -73,7 +73,7 @@ module Rao
73
73
  # end
74
74
 
75
75
  def extract_table_column_and_operator(string)
76
- if string =~ /([\.a-z_]{1,})\(([a-z_]{2,})\)/
76
+ if string =~ /([\.a-z0-9_]{1,})\(([a-z0-9_]{2,})\)/
77
77
  table_and_column = $~[1]
78
78
  operator = $~[2]
79
79
  column, table_or_association = table_and_column.split('.').reverse
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rao-query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.47.pre
4
+ version: 0.0.49.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-25 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rao
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3.6
61
+ version: '1.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.3.6
68
+ version: '1.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec-rails
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -189,7 +189,6 @@ files:
189
189
  - README.md
190
190
  - Rakefile
191
191
  - app/concerns/rao/query/controller/query_concern.rb
192
- - app/concerns/rao/query/controller/query_form_concern.rb~
193
192
  - app/form_builders/rao/query/form_builder.rb
194
193
  - app/parsers/rao/query/condition_parser.rb
195
194
  - app/view_helpers/rao/query/application_helper.rb
@@ -215,14 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
214
  requirements:
216
215
  - - ">="
217
216
  - !ruby/object:Gem::Version
218
- version: '0'
217
+ version: 2.6.0
219
218
  required_rubygems_version: !ruby/object:Gem::Requirement
220
219
  requirements:
221
220
  - - ">"
222
221
  - !ruby/object:Gem::Version
223
222
  version: 1.3.1
224
223
  requirements: []
225
- rubygems_version: 3.1.4
224
+ rubygems_version: 3.4.11
226
225
  signing_key:
227
226
  specification_version: 4
228
227
  summary: Simple Filter Queries for Ruby on Rails.
@@ -1,13 +0,0 @@
1
- module Rao
2
- module Query
3
- module Controller
4
- module QueryFormConcern
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- view_helper Rao::Query::ApplicationHelper, as: :query_helper
9
- end
10
- end
11
- end
12
- end
13
- end