tablets 0.3.7 → 0.3.8

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: fabd1f1477cd295cede4c19f5401f3200a19dd2d
4
- data.tar.gz: 7dbfdf2ae6f5e4ee8c7fc40c351ef4b1130e3d50
3
+ metadata.gz: b2b9c6ae56d77fa44950ef647ae6492ad50803f4
4
+ data.tar.gz: 1bed78d14eee5c42e294b1f3103ddcb6de070a3e
5
5
  SHA512:
6
- metadata.gz: 96286ea703337dd2e0123835c8fc9a41c35455a1c3b1680e178ec0bcab57d1292fd91cce2e0026e15c96c07ad6e962947bdfb461568741cd38107e7d6d9f1da3
7
- data.tar.gz: 3ea819cbd7b92d3d0ffb38f9ac3bc77333877e7515c9af05df0d9bcb5a56d06525f97461eb3df1e472613ca682ac3c7d0e3e50120be3c6c8739efdee2c4386a3
6
+ metadata.gz: a534d1816ca669da1c8636d7eb500c03ff913ff19e2c0e1450fbfaee3e8c2a86e7b384bef9973fe1b0b6aa19364dc19478dfd28f0210159b617fab1b3399183c
7
+ data.tar.gz: faf361c98793fdda26042efc0e5c9aae4d27c7ee8da22abc5d46916eca73b34dfc4407ed6a0d747a28a57023660c6a74a3f9a0f244e8d198dcd54f51fb2e7274
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/tablets.svg)](http://badge.fury.io/rb/tablets)
4
4
  [![Code Climate](https://codeclimate.com/github/zenedge/tablets/badges/gpa.svg)](https://codeclimate.com/github/zenedge/tablets)
5
- [![Test Coverage](https://codeclimate.com/github/zenedge/tablets/badges/coverage.svg)](https://codeclimate.com/github/zenedge/tablets/coverage)
6
5
 
7
6
  ## Installation
8
7
 
@@ -1,7 +1,7 @@
1
1
  module Tablets
2
2
  # Responsible to provide data to tablet on ajax request.
3
3
  class AjaxController < ApplicationController
4
- before_filter :authorize!
4
+ before_action :authorize!
5
5
 
6
6
  def data
7
7
  render json: Tablets::Data.new(tablet, data_params, self)
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  Tablets::Engine.routes.draw do
2
- get 'ajax/:name/data', to: 'tablets/ajax#data', as: :data
2
+ post 'ajax/:name/data', to: 'tablets/ajax#data', as: :data
3
3
  end
@@ -1,6 +1,6 @@
1
- require 'active_support/core_ext/object'
1
+ require 'active_support/core_ext/object/blank'
2
2
 
3
- require 'tablets/utils/search_condition'
3
+ require 'tablets/utils/search_condition_builder'
4
4
 
5
5
  require 'tablets/data/processing/base'
6
6
 
@@ -18,7 +18,7 @@ module Tablets
18
18
 
19
19
  # Applies search conditions if need.
20
20
  def search(relation)
21
- return relation unless params[:search].try(:[], :value).present?
21
+ return relation unless params[:search].fetch(:value, nil).present?
22
22
 
23
23
  conditions = build_conditions_for(params[:search][:value])
24
24
  relation = relation.where(conditions) if conditions
@@ -40,7 +40,7 @@ module Tablets
40
40
  # Returs search conditions for each searchable column.
41
41
  def search_conditions(value)
42
42
  searchable_columns.map do |column|
43
- Tablets::Utils::SearchCondition.build(column, value)
43
+ Tablets::Utils::SearchConditionBuilder.new(column, value).build
44
44
  end.join(' OR ')
45
45
  end
46
46
  end
@@ -22,7 +22,7 @@ module Tablets
22
22
  # Determines order direction from params.
23
23
  # ASC by default.
24
24
  def direction(item)
25
- if %w(ASC DESC).include?(item[:dir].upcase)
25
+ if %w(ASC DESC).include?(item.fetch(:dir, '').upcase)
26
26
  item[:dir].upcase
27
27
  else
28
28
  'ASC'
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/object'
1
+ require 'active_support/core_ext/object/blank'
2
2
 
3
3
  require 'tablets/data/processing/filter'
4
4
  require 'tablets/data/processing/paginate'
data/lib/tablets/data.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'active_support/core_ext/object'
2
-
3
1
  require 'tablets/data/query'
4
2
 
5
3
  module Tablets
@@ -55,7 +53,7 @@ module Tablets
55
53
  end.to_h
56
54
 
57
55
  details = tablet.details(record)
58
- data[:details] = details if details.present?
56
+ data[:details] = details unless details.nil?
59
57
 
60
58
  data
61
59
  end
@@ -64,8 +62,8 @@ module Tablets
64
62
  # Returns single cell value, for specified record and for specified column.
65
63
  def cell(record, column)
66
64
  case column[:data]
67
- when Symbol then record.send(column[:data])
68
- when Proc then column[:data].call(record, @controller)
65
+ when Symbol then record.send(column[:data])
66
+ when Proc then column[:data].call(record, @controller)
69
67
  end
70
68
  end
71
69
  end
@@ -28,6 +28,7 @@ module Tablets
28
28
  order: [0, 'asc'],
29
29
  autoWidth: true,
30
30
  orderCellsTop: true,
31
+ serverMethod: 'POST',
31
32
  language: {
32
33
  lengthMenu: '<span class=\'seperator\'>|</span>View _MENU_ records',
33
34
  info: '<span class=\'seperator\'>|</span>Found total _TOTAL_ records',
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/object'
1
+ require 'active_support/core_ext/object/blank'
2
2
 
3
3
  require 'tablets/engine'
4
4
 
@@ -26,7 +26,7 @@ module Tablets
26
26
  id: id,
27
27
  name: tablet.name,
28
28
  columns: tablet.columns,
29
- options: options,
29
+ options: resulting_options,
30
30
  params: params
31
31
  }
32
32
  end
@@ -41,11 +41,10 @@ module Tablets
41
41
  end
42
42
 
43
43
  # Calculates resulting options.
44
- def options
45
- @options ||= {}
46
- .merge(Tablets.options)
47
- .merge(columnDefs: columns_definitions, ajax: data_path)
48
- .merge(tablet.options)
44
+ def resulting_options
45
+ {}.merge(Tablets.options)
46
+ .merge(columnDefs: columns_definitions, ajax: data_path)
47
+ .merge(tablet.options)
49
48
  end
50
49
 
51
50
  # Calculates column options and applies options on top.
@@ -44,7 +44,7 @@ module Tablets
44
44
  # Returns database relation to fetch data.
45
45
  # By default tries to deduct class from tablet name.
46
46
  def relation(params = {})
47
- if defined? @name.camelize.constantize
47
+ if defined? @name.singularize.camelize.constantize
48
48
  call(:relation, params) { @name.camelize.constantize.where(nil) }
49
49
  else
50
50
  call(:relation, params)
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/object'
1
+ require 'active_support/core_ext/object/blank'
2
2
 
3
3
  module Tablets
4
4
  module Utils
@@ -0,0 +1,70 @@
1
+ require 'rails'
2
+ require 'active_record'
3
+
4
+ module Tablets
5
+ module Utils
6
+ # Resposible for building database specific search conditions.
7
+ class SearchConditionBuilder
8
+ attr_reader :column, :query
9
+
10
+ # Initializes builder.
11
+ def initialize(column, query)
12
+ @column = column
13
+ @query = query
14
+ end
15
+
16
+ # Builds search condition for specific db type.
17
+ def build
18
+ sanitize "(#{prepared_column} #{like} ?)", "%#{query}%"
19
+ end
20
+
21
+ private
22
+
23
+ # Sanitizes sql expression with params.
24
+ def sanitize(sql, *params)
25
+ ActiveRecord::Base.send(:sanitize_sql_array, [sql, *params])
26
+ end
27
+
28
+ # Returns column prepared for using in SQL statement.
29
+ def prepared_column
30
+ cast quote @column
31
+ end
32
+
33
+ # Cast column to string.
34
+ def cast(column)
35
+ "CAST (#{column} AS #{string_type})"
36
+ end
37
+
38
+ # Quotes column name.
39
+ def quote(column)
40
+ column.split('.').map do |component|
41
+ ActiveRecord::Base.connection.quote_column_name component
42
+ end.join('.')
43
+ end
44
+
45
+ # Returns database specific like operator.
46
+ def like
47
+ case db_adapter
48
+ when :postgresql then 'ILIKE'
49
+ when :mysql2 then 'LIKE'
50
+ when :sqlite3 then 'LIKE'
51
+ end
52
+ end
53
+
54
+ # Returns database specific string type.
55
+ def string_type
56
+ case db_adapter
57
+ when :postgresql then 'VARCHAR'
58
+ when :mysql2 then 'CHAR'
59
+ when :sqlite3 then 'TEXT'
60
+ end
61
+ end
62
+
63
+ # Retrieves rails database adapter.
64
+ def db_adapter
65
+ @db_adapter ||=
66
+ ActiveRecord::Base.configurations[Rails.env]['adapter'].to_sym
67
+ end
68
+ end
69
+ end
70
+ end
@@ -1,3 +1,17 @@
1
1
  module Tablets
2
- VERSION = '0.3.7'
2
+ # Tablets gem version.
3
+ module Version
4
+ MAJOR = 0
5
+ MINOR = 3
6
+ TINY = 8
7
+ PRE = nil
8
+
9
+ class << self
10
+ def to_s
11
+ [MAJOR, MINOR, TINY, PRE].compact.join('.')
12
+ end
13
+
14
+ alias_method :to_str, :to_s
15
+ end
16
+ end
3
17
  end
data/lib/tablets.rb CHANGED
@@ -15,5 +15,7 @@ require 'tablets/version'
15
15
 
16
16
  require 'tablets/tablet'
17
17
 
18
- require 'tablets/railtie'
19
- require 'tablets/engine'
18
+ if defined? Rails
19
+ require 'tablets/railtie'
20
+ require 'tablets/engine'
21
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ require 'tablets/data/processing/filter'
4
+
5
+ RSpec.describe Tablets::Data::Processing::Filter do
6
+ subject { described_class.new(params, columns) }
7
+
8
+ let(:relation) { double }
9
+ let(:params) { { search: { value: value } } }
10
+
11
+ describe '#apply' do
12
+ let(:value) { 'query1 query2' }
13
+
14
+ before do
15
+ allow_any_instance_of(
16
+ Tablets::Utils::SearchConditionBuilder
17
+ ).to receive(:build) { |builder| "#{builder.column} #{builder.query}" }
18
+
19
+ allow(relation).to receive(:where).and_return(relation)
20
+ end
21
+
22
+ let(:columns) { [{ search: %w(column1 column2) }] }
23
+ let!(:result) { subject.apply(relation) }
24
+
25
+ it 'applies search conditions' do
26
+ expect(relation).to have_received(:where).with(
27
+ '(column1 query1 OR column2 query1) AND ' \
28
+ '(column1 query2 OR column2 query2)'
29
+ )
30
+ end
31
+
32
+ it 'returns relation' do
33
+ expect(result).to eq(relation)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper'
2
+
3
+ require 'tablets/data/processing/order'
4
+
5
+ RSpec.describe Tablets::Data::Processing::Order do
6
+ subject { described_class.new(params, columns) }
7
+
8
+ let(:relation) { double }
9
+ let(:order) { {} }
10
+ let(:params) { { order: order } }
11
+
12
+ describe '#apply' do
13
+ before do
14
+ allow(order).to receive(:values).and_return(values)
15
+ allow(relation).to receive(:order).and_return(relation)
16
+ end
17
+
18
+ let!(:result) { subject.apply(relation) }
19
+
20
+ context 'simple' do
21
+ let(:field) { 'field' }
22
+ let(:direction) { 'DESC' }
23
+ let(:columns) { [{ order: field }] }
24
+ let(:values) { [{ column: 0, dir: direction }] }
25
+
26
+ it 'applies order' do
27
+ expect(relation).to have_received(:order).with("#{field} #{direction}")
28
+ end
29
+
30
+ it 'returns relation' do
31
+ expect(result).to eq(relation)
32
+ end
33
+ end
34
+
35
+ context 'without direction' do
36
+ let(:field) { 'field' }
37
+ let(:columns) { [{ order: field }] }
38
+ let(:values) { [{ column: 0 }] }
39
+
40
+ it 'applies order with default direction' do
41
+ expect(relation).to have_received(:order).with("#{field} ASC")
42
+ end
43
+
44
+ it 'returns relation' do
45
+ expect(result).to eq(relation)
46
+ end
47
+ end
48
+
49
+ context 'multiple' do
50
+ let(:orders) do
51
+ (0..1).map do |index|
52
+ { field: "field#{index}", direction: 'DESC' }
53
+ end
54
+ end
55
+ let(:columns) { orders.map { |order| { order: order[:field] } } }
56
+ let(:values) do
57
+ orders.map.with_index do |order, index|
58
+ { column: index, dir: order[:direction] }
59
+ end
60
+ end
61
+
62
+ it 'applies order' do
63
+ orders.each do |order|
64
+ expect(relation).to have_received(:order)
65
+ .with("#{order[:field]} #{order[:direction]}")
66
+ end
67
+ end
68
+
69
+ it 'returns relation' do
70
+ expect(result).to eq(relation)
71
+ end
72
+ end
73
+ end
74
+ end
@@ -12,8 +12,8 @@ RSpec.describe Tablets::Global::Store do
12
12
 
13
13
  before do
14
14
  subject.instance_eval { @tablets = {} }
15
- allow(Tablets::Tablet).to receive(:new).with(name, &block)
16
- .and_return(tablet)
15
+ allow(Tablets::Tablet).to receive(:new)
16
+ .with(name, &block).and_return(tablet)
17
17
  end
18
18
 
19
19
  let!(:result) { subject.register(name, &block) }
@@ -70,33 +70,28 @@ RSpec.describe Tablets::Renderer do
70
70
  end
71
71
 
72
72
  it 'renders tablets partial' do
73
- expect(view_context).to have_received(:render).with(
74
- hash_including(partial: 'tablets/tablet')
75
- )
73
+ expect(view_context).to have_received(:render)
74
+ .with(hash_including(partial: 'tablets/tablet'))
76
75
  end
77
76
 
78
77
  it 'passes correct id as partial locals' do
79
- expect(view_context).to have_received(:render).with(
80
- locals(id: 'posts_user_id_1_tablet')
81
- )
78
+ expect(view_context).to have_received(:render)
79
+ .with(locals(id: 'posts_user_id_1_tablet'))
82
80
  end
83
81
 
84
82
  it 'passes correct columns as partial locals' do
85
- expect(view_context).to have_received(:render).with(
86
- locals(columns: tablet_columns)
87
- )
83
+ expect(view_context).to have_received(:render)
84
+ .with(locals(columns: tablet_columns))
88
85
  end
89
86
 
90
87
  it 'passes correct config as partial locals' do
91
- expect(view_context).to have_received(:render).with(
92
- locals(options: hash_including(options))
93
- )
88
+ expect(view_context).to have_received(:render)
89
+ .with(locals(options: hash_including(options)))
94
90
  end
95
91
 
96
92
  it 'passes correct params as partial locals' do
97
- expect(view_context).to have_received(:render).with(
98
- locals(params: params)
99
- )
93
+ expect(view_context).to have_received(:render)
94
+ .with(locals(params: params))
100
95
  end
101
96
 
102
97
  it 'returns render result' do
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ require 'tablets'
4
+
5
+ require 'tablets/tablet'
6
+
7
+ RSpec.describe Tablets::Tablet do
8
+ let(:name) { 'example' }
9
+ let(:block) { proc {} }
10
+
11
+ subject { described_class.new(name, &block) }
12
+
13
+ def self.define(callback, value)
14
+ let(:block) do
15
+ proc { send(callback) { value } }
16
+ end
17
+ end
18
+
19
+ context '#relation' do
20
+ context 'if configured' do
21
+ define(:relation, 'relation')
22
+
23
+ let!(:result) { subject.relation }
24
+
25
+ it 'return column configuration' do
26
+ expect(result).to eq('relation')
27
+ end
28
+ end
29
+ end
30
+
31
+ context '#columns' do
32
+ context 'if configured' do
33
+ define(:columns, 'columns')
34
+
35
+ let!(:result) { subject.columns }
36
+
37
+ it 'return column configuration' do
38
+ expect(result).to eq('columns')
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ require 'tablets/utils/search_condition_builder'
4
+
5
+ RSpec.describe Tablets::Utils::SearchConditionBuilder do
6
+ subject { described_class.new(column, query) }
7
+
8
+ before do
9
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
10
+ database: ':memory:')
11
+
12
+ allow(Rails).to receive(:env).and_return('env')
13
+ allow(ActiveRecord::Base).to receive(:configurations)
14
+ .and_return('env' => { 'adapter' => adapter })
15
+ end
16
+
17
+ describe '#build' do
18
+ let(:column) { 'table.column' }
19
+ let(:query) { 'query' }
20
+ let!(:result) { subject.build }
21
+
22
+ context 'postgresql' do
23
+ let(:adapter) { 'postgresql' }
24
+
25
+ it 'returns correct SQL statement' do
26
+ expect(result).to eq(
27
+ '(CAST ("table"."column" AS VARCHAR) ILIKE \'%query%\')'
28
+ )
29
+ end
30
+ end
31
+
32
+ context 'mysql2' do
33
+ let(:adapter) { 'mysql2' }
34
+
35
+ it 'returns correct SQL statement' do
36
+ expect(result).to eq(
37
+ '(CAST ("table"."column" AS CHAR) LIKE \'%query%\')'
38
+ )
39
+ end
40
+ end
41
+
42
+ context 'sqlite3' do
43
+ let(:adapter) { 'sqlite3' }
44
+
45
+ it 'returns correct SQL statement' do
46
+ expect(result).to eq(
47
+ '(CAST ("table"."column" AS TEXT) LIKE \'%query%\')'
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end
@@ -16,10 +16,10 @@ RSpec.describe Tablets::ViewHelpers do
16
16
 
17
17
  before do
18
18
  allow(Tablets).to receive(:[]).with(name).and_return(tablet)
19
- allow(Tablets::Renderer).to receive(:new).with(tablet, params)
20
- .and_return(renderer)
21
- allow(renderer).to receive(:render).with(subject)
22
- .and_return(render_result)
19
+ allow(Tablets::Renderer).to receive(:new)
20
+ .with(tablet, params).and_return(renderer)
21
+ allow(renderer).to receive(:render)
22
+ .with(subject).and_return(render_result)
23
23
  end
24
24
 
25
25
  let!(:result) { subject.render_tablet(name, params) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tablets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yevhen Shemet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-08-25 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: 4.2.0
19
+ version: 4.0.0
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: 4.2.0
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jquery-datatables-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -127,17 +127,21 @@ files:
127
127
  - lib/tablets/renderer.rb
128
128
  - lib/tablets/tablet.rb
129
129
  - lib/tablets/utils/config.rb
130
- - lib/tablets/utils/search_condition.rb
130
+ - lib/tablets/utils/search_condition_builder.rb
131
131
  - lib/tablets/version.rb
132
132
  - lib/tablets/view_helpers.rb
133
133
  - spec/lib/tablets/data/processing/base_spec.rb
134
+ - spec/lib/tablets/data/processing/filter_spec.rb
135
+ - spec/lib/tablets/data/processing/order_spec.rb
134
136
  - spec/lib/tablets/data/processing/paginate_spec.rb
135
137
  - spec/lib/tablets/data/query_spec.rb
136
138
  - spec/lib/tablets/global/configurator_spec.rb
137
139
  - spec/lib/tablets/global/loader_spec.rb
138
140
  - spec/lib/tablets/global/store_spec.rb
139
141
  - spec/lib/tablets/renderer_spec.rb
142
+ - spec/lib/tablets/tablet_spec.rb
140
143
  - spec/lib/tablets/utils/config_spec.rb
144
+ - spec/lib/tablets/utils/search_condition_builder_spec.rb
141
145
  - spec/lib/tablets/view_helpers_spec.rb
142
146
  - spec/spec_helper.rb
143
147
  homepage: https://github.com/zenedge/tablets
@@ -168,10 +172,14 @@ test_files:
168
172
  - spec/spec_helper.rb
169
173
  - spec/lib/tablets/data/processing/base_spec.rb
170
174
  - spec/lib/tablets/data/processing/paginate_spec.rb
175
+ - spec/lib/tablets/data/processing/order_spec.rb
176
+ - spec/lib/tablets/data/processing/filter_spec.rb
171
177
  - spec/lib/tablets/data/query_spec.rb
172
178
  - spec/lib/tablets/global/store_spec.rb
173
179
  - spec/lib/tablets/global/configurator_spec.rb
174
180
  - spec/lib/tablets/global/loader_spec.rb
175
181
  - spec/lib/tablets/view_helpers_spec.rb
182
+ - spec/lib/tablets/utils/search_condition_builder_spec.rb
176
183
  - spec/lib/tablets/utils/config_spec.rb
184
+ - spec/lib/tablets/tablet_spec.rb
177
185
  - spec/lib/tablets/renderer_spec.rb
@@ -1,56 +0,0 @@
1
- module Tablets
2
- module Utils
3
- # Resposible for building database specific search conditions.
4
- module SearchCondition
5
- class << self
6
- # Builds search condition for specific db type.
7
- def build(column, query)
8
- sanitize "(#{casted_column(column)} #{like} ?)", "%#{query}%"
9
- end
10
-
11
- private
12
-
13
- # Sanitizes sql expression with params.
14
- def sanitize(sql, *params)
15
- ActiveRecord::Base.send(:sanitize_sql_array, [sql, *params])
16
- end
17
-
18
- # Casyt column to string.
19
- def casted_column(column)
20
- "CAST (#{quoted_column(column)} AS #{string_type})"
21
- end
22
-
23
- # Quotes column name.
24
- def quoted_column(column)
25
- column.split('.').map do |component|
26
- ActiveRecord::Base.connection.quote_column_name component
27
- end.join('.')
28
- end
29
-
30
- # Returns database specific like operator.
31
- def like
32
- case db_adapter
33
- when :postgresql then 'ILIKE'
34
- when :mysql2 then 'LIKE'
35
- when :sqlite3 then 'LIKE'
36
- end
37
- end
38
-
39
- # Returns database specific string type.
40
- def string_type
41
- case db_adapter
42
- when :postgresql then 'VARCHAR'
43
- when :mysql2 then 'CHAR'
44
- when :sqlite3 then 'TEXT'
45
- end
46
- end
47
-
48
- # Retrieves rails database adapter.
49
- def db_adapter
50
- @db_adapter ||=
51
- ActiveRecord::Base.configurations[Rails.env]['adapter'].to_sym
52
- end
53
- end
54
- end
55
- end
56
- end