the_grid 1.1.6 → 1.1.7

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzE3MTZmMzNjMjc3MjI2MDg5YTM5ODQzOWQwMzNmYmRlOGM2ODRhNw==
4
+ MTM1NmQ4NWY0NzU5NmEyMjg0Y2NiYjAxMGFkNjY3ZmY1OTZhNzJmZQ==
5
5
  data.tar.gz: !binary |-
6
- ZjgwNzUxMjdhZGEzYzFkYmZmNjQ0YjdjMjMyZjcxYTNhYjUzZjJjNQ==
6
+ NTZkOWU3Y2NlOWY1NTlhM2M1OTBhMTc4M2Y5NTdiOWQzZWJjNzM0MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjEyNDEwYTIwZDI4YjRlNGJkOTk4OWM2YmYxYWUyN2Q0NTQ2ZjJmMTY1Yzc4
10
- MTVhMmZkNTIzZGQ2MDUyZTlkNmNhZjg1ZjA4ODc5Y2ExN2JkNGYzZWVjOTQ4
11
- ZDA2M2VmZGZjZTZmYzRmNTdjY2I2NmU3MDgwNzAzZDM3ODc2ODk=
9
+ MjE4MGZmZmZiMjRmZTU3ZjJiN2I3ZjE0OGE0MDhiNGU2ZGZkZWIwNWM0MDNk
10
+ MThhODdlNDI0YTI2YzRlMzM0OTA1YmIyZThiMzdiODE2ZjE4ZDJmNWQ5MGMw
11
+ MjA0NTgwYjM0MTc1NzY5MGM3ZmJjNWRiNDRiYTNjNDY5ZGVlYTE=
12
12
  data.tar.gz: !binary |-
13
- MTRhNDI4MDRiOGQ0ZjllOTYzY2U0ZWY0MTE0NTBhNWUyN2Q3OTZlMzhlZDJl
14
- NTk2MjY3NjI0NjJhMGM3NWU3MWRhZTEwYzcxNDZjZWNjZjZkNjc5ZjVkMjA4
15
- NTQ2NmJhMWMyOWIyYjA1ZDE0YzM2YTJkYzQ3MzRjNWI5Y2YwZGM=
13
+ YTk5MDMwY2UwYWRjOGM5ZDFiNjgyNmI0MjUxZjc5OTZkMDBlMDYyODhlMmZh
14
+ YmFjNWQ2MTUwMzBkMmI1MDg2Njg2YTZhYmI1ZTYzMzFhY2EwNTRjY2VmZTI4
15
+ N2RjZDdhOWJhMDFmN2M4YzE2YmFkNmM2ZjIwOWM2ZjEwNmM2ODA=
@@ -3,7 +3,7 @@ module TheGrid
3
3
  def configure(relation, params)
4
4
  {}.tap do |o|
5
5
  o[:field] = params[:field]
6
- o[:field] = "#{relation.table_name}.#{o[:field]}" if relation.table[o[:field]].present?
6
+ o[:field] = "#{relation.table_name}.#{o[:field]}" if relation.column_names.include?(params[:field])
7
7
 
8
8
  o[:order] = params[:order]
9
9
  o[:order] = 'asc' unless %w{ asc desc }.include?(o[:order])
@@ -1,3 +1,3 @@
1
1
  module TheGrid
2
- VERSION = "1.1.6"
2
+ VERSION = "1.1.7"
3
3
  end
@@ -1,23 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe TheGrid::Api::Command::Sort do
4
- let(:table) { double(:name => "table_for_sort", :present? => true).as_null_object }
5
- let(:relation) { double(:table_name => table.name, :table => table) }
4
+ let(:relation) { double(:table_name => "table_for_sort", :column_names => %w{id name}) }
6
5
  let(:options) { {:field => "name", :order => "desc" } }
7
6
 
8
7
  after(:each){ subject.execute_on(relation, options) }
9
8
 
10
9
  it "sort by asc if order invalid" do
11
10
  options[:order] = 'wrong order'
12
- relation.should_receive(:order).with("#{table.name}.#{options[:field]} asc")
11
+ relation.should_receive(:order).with("#{relation.table_name}.#{options[:field]} asc")
13
12
  end
14
13
 
15
14
  it "sort by specified order" do
16
- relation.should_receive(:order).with("#{table.name}.#{options[:field]} #{options[:order]}")
15
+ relation.should_receive(:order).with("#{relation.table_name}.#{options[:field]} #{options[:order]}")
17
16
  end
18
17
 
19
18
  it "does not prepend field with table name if field is an alias" do
20
- table.stub(:present? => false)
19
+ options[:field] = 'title'
21
20
  relation.should_receive(:order).with("#{options[:field]} #{options[:order]}")
22
21
  end
23
22
  end
@@ -19,11 +19,6 @@ Gem::Specification.new do |s|
19
19
  Tags: json, csv, grid, api, grid builder, activerecord relation builder, relation
20
20
  EOF
21
21
 
22
- s.post_install_message = <<-_MSG_
23
- Columns' definition in json response is changed
24
- because javascript does not remember the order of properties in object.
25
- _MSG_
26
-
27
22
  s.files = `git ls-files`.split("\n")
28
23
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
24
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -31,7 +26,7 @@ Gem::Specification.new do |s|
31
26
 
32
27
  s.add_dependency 'activerecord', '>= 3.0'
33
28
  s.add_dependency 'json'
34
-
29
+
35
30
  s.add_development_dependency "bundler", ">= 1.0.0"
36
31
  s.add_development_dependency "rspec", "~> 2.13"
37
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergiy Stotskiy
@@ -118,8 +118,7 @@ homepage: http://github.com/stalniy/grid
118
118
  licenses:
119
119
  - MIT
120
120
  metadata: {}
121
- post_install_message: ! " Columns' definition in json response is changed\n because
122
- javascript does not remember the order of properties in object.\n"
121
+ post_install_message:
123
122
  rdoc_options: []
124
123
  require_paths:
125
124
  - lib