baseapi 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddb8da45b8a1dd667408550c02c42077b4f5c4c5
4
- data.tar.gz: 110e4114ffa61e149ff2039a4cdc52e2ab248ba7
3
+ metadata.gz: 2fb67821b5f3db39fea1ef9dd96883c4341cdede
4
+ data.tar.gz: d7ebdd268fb277a8c6f07ca499874d6088a3e2a3
5
5
  SHA512:
6
- metadata.gz: b1f630706f818c6693b1ed6f5996ae09d2e310697f0d2a1932d03f41d7be64c33122356f10ad618ed1a3c0a19962f58de87fffc37f86659487919d65ae00128d
7
- data.tar.gz: 22456f8d54ace03c59947314ae5a7ab5eddabccba5d70cef11695c4801b6ae68c392cdf571e627ff77d9326aaaaf96572dad99e69ea6aa05e74da205f2527530
6
+ metadata.gz: ab5bec3a4805c440a0a52b64c62bb1822333169426703c60526bc901df682d6fc2c6c53d98bfb6a9bcd02b396692618dbf762ab487c7a7f8f1b1634831164421
7
+ data.tar.gz: 73e08bf142091102411f8dca9a293c24abadb9cbcf39f3ace5b62d7c0d0d46e0f8f98ddaa43f280c2de399205f7439e351e7009f2cf27a73341a628f18dcc95a
data/README.md CHANGED
@@ -102,12 +102,12 @@ Specify the sorting order
102
102
  GET /users.json?order=desc&orderby=name
103
103
  SQL => SELECT DISTINCT `users`.* FROM `users` ORDER BY `users`.`name` DESC
104
104
 
105
- Specify the multiple sorting order (v0.1.19~)
105
+ Specify the multiple sorting order (v0.1.21~)
106
106
 
107
107
  GET /users.json?order[]=desc&order[]=asc&orderby[]=name&orderby[]=company_id
108
108
  SQL => SELECT DISTINCT `users`.* FROM `users` ORDER BY name DESC, company_id ASC
109
109
 
110
- Specify the association sorting order (v0.1.19~)
110
+ Specify the association sorting order (v0.1.21~)
111
111
 
112
112
  GET /users.json?order=asc&orderby=company.name
113
113
  SQL => SELECT DISTINCT `users`.* FROM `users` ...JOIN... ORDER BY companies.name ASC
@@ -82,12 +82,17 @@ module ActiveRecordRelationExtension
82
82
  table_name = joins_tables.count > 0 ? joins_tables.last.pluralize.underscore : ''
83
83
  # joins_tables exists check
84
84
  joins_tables.each do |table|
85
- next unless ActiveRecord::Base.connection.tables.include?(table.pluralize.underscore)
85
+ next if !ActiveRecord::Base.connection.tables.include?(table.pluralize.underscore)
86
+ end
87
+ if table_name.present?
88
+ # table exists check
89
+ next if table_name.present? and !ActiveRecord::Base.connection.tables.include?(table_name)
90
+ # column_name exists check
91
+ next if !table_name.camelize.singularize.constantize.column_names.include?(column_name)
92
+ else
93
+ # column_name exists check
94
+ next if !self.model.column_names.include?(column_name)
86
95
  end
87
- # table_name exists check
88
- next unless ActiveRecord::Base.connection.tables.include?(table_name)
89
- # column_name exists check
90
- next unless table_name.camelize.singularize.constantize.column_names.include?(column_name)
91
96
  # joins
92
97
  joins_array!(joins_tables)
93
98
  # order
@@ -1,3 +1,3 @@
1
1
  module Baseapi
2
- VERSION = "0.1.20"
2
+ VERSION = "0.1.21"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baseapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moriyuki Arakawa