wice_grid 3.6.0 → 3.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -3
  3. data/Gemfile +0 -1
  4. data/Rakefile +1 -11
  5. data/config/locales/uk.yml +29 -29
  6. data/lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb +0 -1
  7. data/lib/generators/wice_grid/install_generator.rb +0 -1
  8. data/lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb +0 -1
  9. data/lib/generators/wice_grid/templates/wice_grid_config.rb +3 -4
  10. data/lib/wice/active_record_column_wrapper.rb +1 -2
  11. data/lib/wice/columns.rb +9 -10
  12. data/lib/wice/columns/column_action.rb +0 -1
  13. data/lib/wice/columns/column_boolean.rb +0 -1
  14. data/lib/wice/columns/column_bootstrap_datepicker.rb +0 -1
  15. data/lib/wice/columns/column_custom_dropdown.rb +0 -1
  16. data/lib/wice/columns/column_float.rb +0 -1
  17. data/lib/wice/columns/column_html5_datepicker.rb +0 -1
  18. data/lib/wice/columns/column_integer.rb +0 -1
  19. data/lib/wice/columns/column_jquery_datepicker.rb +0 -1
  20. data/lib/wice/columns/column_processor_index.rb +0 -1
  21. data/lib/wice/columns/column_rails_date_helper.rb +0 -1
  22. data/lib/wice/columns/column_rails_datetime_helper.rb +0 -1
  23. data/lib/wice/columns/column_range.rb +0 -1
  24. data/lib/wice/columns/column_string.rb +0 -1
  25. data/lib/wice/columns/common_date_datetime_mixin.rb +0 -1
  26. data/lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb +0 -1
  27. data/lib/wice/columns/common_js_date_datetime_mixin.rb +0 -1
  28. data/lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb +0 -1
  29. data/lib/wice/columns/common_standard_helper_date_datetime_mixin.rb +0 -1
  30. data/lib/wice/grid_output_buffer.rb +3 -4
  31. data/lib/wice/grid_renderer.rb +11 -12
  32. data/lib/wice/helpers/bs_calendar_helpers.rb +2 -3
  33. data/lib/wice/helpers/js_calendar_helpers.rb +1 -2
  34. data/lib/wice/helpers/wice_grid_misc_view_helpers.rb +2 -3
  35. data/lib/wice/helpers/wice_grid_serialized_queries_view_helpers.rb +4 -5
  36. data/lib/wice/helpers/wice_grid_view_helpers.rb +12 -11
  37. data/lib/wice/kaminari_monkey_patching.rb +0 -2
  38. data/lib/wice/table_column_matrix.rb +1 -2
  39. data/lib/wice/wice_grid_controller.rb +4 -5
  40. data/lib/wice/wice_grid_core_ext.rb +0 -1
  41. data/lib/wice/wice_grid_misc.rb +4 -5
  42. data/lib/wice/wice_grid_serialized_queries_controller.rb +0 -1
  43. data/lib/wice/wice_grid_serialized_query.rb +0 -1
  44. data/lib/wice/wice_grid_spreadsheet.rb +0 -1
  45. data/lib/wice_grid.rb +16 -17
  46. data/spec/schema.rb +0 -1
  47. data/spec/spec_helper.rb +0 -1
  48. data/spec/support/active_record.rb +0 -1
  49. data/spec/support/wice_grid_test_config.rb +0 -2
  50. data/spec/wice/grid_output_buffer_spec.rb +0 -2
  51. data/spec/wice/table_column_matrix_spec.rb +0 -2
  52. data/spec/wice/wice_grid_misc_spec.rb +0 -2
  53. data/spec/wice/wice_grid_spreadsheet_spec.rb +0 -2
  54. data/wice_grid.gemspec +3 -5
  55. metadata +37 -51
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice #:nodoc:
3
2
  module BsCalendarHelpers #:nodoc:
4
3
 
@@ -57,8 +56,8 @@ module Wice #:nodoc:
57
56
  calendar_data.date_string = options[:initial_date].nil? ? '' : options[:initial_date].strftime(date_format)
58
57
  calendar_data.dom_id = options[:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_')
59
58
  calendar_data.datepicker_placeholder_id = calendar_data.dom_id + '_date_placeholder'
60
- calendar_data.date_div_id = calendar_data.dom_id + '_date_view'
61
- calendar_data.close_calendar_event_name = "wg:calendarChanged_#{options[:grid_name]}"
59
+ calendar_data.date_div_id = calendar_data.dom_id + '_date_view'
60
+ calendar_data.close_calendar_event_name = "wg:calendarChanged_#{options[:grid_name]}"
62
61
  calendar_data.fire_event = options[:fire_event]
63
62
  end
64
63
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice #:nodoc:
3
2
  module JsCalendarHelpers #:nodoc:
4
3
 
@@ -74,7 +73,7 @@ module Wice #:nodoc:
74
73
  calendar_data.dom_id = options[:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_')
75
74
  calendar_data.datepicker_placeholder_id = calendar_data.dom_id + '_date_placeholder'
76
75
  calendar_data.date_span_id = calendar_data.dom_id + '_date_view'
77
- calendar_data.close_calendar_event_name = "wg:calendarChanged_#{options[:grid_name]}"
76
+ calendar_data.close_calendar_event_name = "wg:calendarChanged_#{options[:grid_name]}"
78
77
  calendar_data.title = options[:title]
79
78
  calendar_data.fire_event = options[:fire_event]
80
79
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
 
4
3
  # Various grid related helpers
@@ -9,7 +8,7 @@ module Wice
9
8
  # The only parameter is a grid object returned by +initialize_grid+ in the controller.
10
9
  def dump_filter_parameters_as_hidden_fields(grid)
11
10
  unless grid.is_a? WiceGrid
12
- fail WiceGridArgumentError.new('dump_filter_parameters_as_hidden_fields: the parameter must be a WiceGrid instance.')
11
+ raise WiceGridArgumentError.new('dump_filter_parameters_as_hidden_fields: the parameter must be a WiceGrid instance.')
13
12
  end
14
13
 
15
14
  grid.get_state_as_parameter_value_pairs(true).collect do|param_name, value|
@@ -51,7 +50,7 @@ module Wice
51
50
  # so I do not document this method to avoid contributing to this misunderstanding.
52
51
  def scaffolded_grid(grid_obj, opts = {}) #:nodoc:
53
52
  unless grid_obj.is_a? WiceGrid
54
- fail WiceGridArgumentError.new('scaffolded_grid: the parameter must be a WiceGrid instance.')
53
+ raise WiceGridArgumentError.new('scaffolded_grid: the parameter must be a WiceGrid instance.')
55
54
  end
56
55
 
57
56
  # debug grid.klass.column_names
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
  module GridViewHelper
4
3
  # View helper to render the list of saved queries and the form to create a new query.
@@ -8,7 +7,7 @@ module Wice
8
7
  # Read section "Adding Application Specific Logic to Saving/Restoring Queries" in README for more details.
9
8
  def saved_queries_panel(grid, opts = {})
10
9
  unless grid.is_a? WiceGrid
11
- fail WiceGridArgumentError.new('saved_queries_panel: the parameter must be a WiceGrid instance.')
10
+ raise WiceGridArgumentError.new('saved_queries_panel: the parameter must be a WiceGrid instance.')
12
11
  end
13
12
 
14
13
  options = { extra_parameters: {}, confirm: 1 }
@@ -40,10 +39,10 @@ module Wice
40
39
  button_tag(
41
40
  NlMessage['save_query_button_label'],
42
41
  class: 'wice-grid-save-query-button btn btn-primary',
43
- 'data-grid-name' => grid_name,
42
+ 'data-grid-name' => grid_name,
44
43
  'data-base-path-to-query-controller' => base_path_to_query_controller,
45
- 'data-parameters' => parameters.to_json,
46
- 'data-ids' => ids.to_json
44
+ 'data-parameters' => parameters.to_json,
45
+ 'data-ids' => ids.to_json
47
46
  ) +
48
47
  '</div></div></div>'
49
48
  ).html_safe
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
  module GridViewHelper
4
3
  # View helper for rendering the grid.
@@ -69,7 +68,7 @@ module Wice
69
68
  # Pease read documentation about the +column+ method to achieve the enlightenment.
70
69
 
71
70
  def grid(grid, opts = {}, &block)
72
- fail WiceGridArgumentError.new('Missing block for the grid helper.' \
71
+ raise WiceGridArgumentError.new('Missing block for the grid helper.' \
73
72
  ' For detached filters use first define_grid with the same API as grid, ' \
74
73
  'then grid_filter to add filters, and then render_grid to actually show the grid') if block.nil?
75
74
  define_grid(grid, opts, &block)
@@ -83,7 +82,7 @@ module Wice
83
82
  def define_grid(grid, opts = {}, &block)
84
83
  # strip the method from HTML stuff
85
84
  unless grid.class == WiceGrid
86
- fail WiceGridArgumentError.new('The first argument for the grid helper must be an instance of the WiceGrid class')
85
+ raise WiceGridArgumentError.new('The first argument for the grid helper must be an instance of the WiceGrid class')
87
86
  end
88
87
 
89
88
  options = {
@@ -140,7 +139,7 @@ module Wice
140
139
  elsif grid.csv_tempfile
141
140
  grid.csv_tempfile.path
142
141
  else
143
- fail WiceGridException.new("Attempt to use 'render_grid' without 'define_grid' before.")
142
+ raise WiceGridException.new("Attempt to use 'render_grid' without 'define_grid' before.")
144
143
  end
145
144
  end
146
145
 
@@ -155,9 +154,11 @@ module Wice
155
154
  rendering.blank_slate_handler
156
155
  end
157
156
 
157
+ # rubocop:disable Style/SymbolProc
158
158
  if rendering.find_one_for(:in_html) { |column| column.detach_with_id }
159
159
  grid.output_buffer.return_empty_strings_for_nonexistent_filters = true
160
160
  end
161
+ # rubocop:enable Style/SymbolProc
161
162
  end
162
163
 
163
164
  def call_block(block, ar, extra_argument = nil) #:nodoc:
@@ -183,14 +184,14 @@ module Wice
183
184
  if column_block_output.is_a?(Array)
184
185
 
185
186
  unless column_block_output.size == 2
186
- fail WiceGridArgumentError.new('When WiceGrid column block returns an array it is expected to contain 2 elements only - ' \
187
+ raise WiceGridArgumentError.new('When WiceGrid column block returns an array it is expected to contain 2 elements only - ' \
187
188
  'the first is the contents of the table cell and the second is a hash containing HTML attributes for the <td> tag.')
188
189
  end
189
190
 
190
191
  column_block_output, additional_opts = column_block_output
191
192
 
192
193
  unless additional_opts.is_a?(Hash)
193
- fail WiceGridArgumentError.new('When WiceGrid column block returns an array its second element is expected to be a ' \
194
+ raise WiceGridArgumentError.new('When WiceGrid column block returns an array its second element is expected to be a ' \
194
195
  "hash containing HTML attributes for the <td> tag. The returned value is #{additional_opts.inspect}. Read documentation.")
195
196
  end
196
197
 
@@ -469,7 +470,7 @@ module Wice
469
470
 
470
471
  base_link_for_filter, base_link_for_show_all_records = rendering.base_link_for_filter(controller, options[:extra_request_parameters])
471
472
 
472
- link_for_export = rendering.link_for_export(controller, 'csv', options[:extra_request_parameters])
473
+ link_for_export = rendering.link_for_export(controller, 'csv', options[:extra_request_parameters])
473
474
 
474
475
  parameter_name_for_query_loading = { grid.name => { q: '' } }.to_query
475
476
  parameter_name_for_focus = { grid.name => { foc: '' } }.to_query
@@ -569,13 +570,13 @@ module Wice
569
570
  # * +filter_key+ an identifier of the filter specified in the column declaration by parameter +:detach_with_id+
570
571
  def grid_filter(grid, filter_key)
571
572
  unless grid.is_a? WiceGrid
572
- fail WiceGridArgumentError.new('grid_filter: the parameter must be a WiceGrid instance.')
573
+ raise WiceGridArgumentError.new('grid_filter: the parameter must be a WiceGrid instance.')
573
574
  end
574
575
  if grid.output_buffer.nil?
575
- fail WiceGridArgumentError.new("grid_filter: You have attempted to run 'grid_filter' before 'grid'. Read about detached filters in the documentation.")
576
+ raise WiceGridArgumentError.new("grid_filter: You have attempted to run 'grid_filter' before 'grid'. Read about detached filters in the documentation.")
576
577
  end
577
578
  if grid.output_buffer == true
578
- fail WiceGridArgumentError.new('grid_filter: You have defined no detached filters, or you try use detached filters with' \
579
+ raise WiceGridArgumentError.new('grid_filter: You have defined no detached filters, or you try use detached filters with' \
579
580
  ':show_filters => :no (set :show_filters to :always in this case). Read about detached filters in the documentation.')
580
581
  end
581
582
 
@@ -684,7 +685,7 @@ module Wice
684
685
  first = collection.offset_value + 1
685
686
  last = collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value
686
687
 
687
- num_pages = collection.num_pages
688
+ num_pages = collection.total_pages
688
689
  end
689
690
 
690
691
  parameters = grid.get_state_as_parameter_value_pairs
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Ugly monkey-patching Kaminari (https://github.com/amatsuda/kaminari/pull/267)
4
2
  module Kaminari #:nodoc:
5
3
  module Helpers #:nodoc:
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
 
4
3
  # a matrix for all declared columns
@@ -48,7 +47,7 @@ module Wice
48
47
 
49
48
  def get_column_in_default_model_class_by_column_name(column_name) #:nodoc:
50
49
  if @default_model_class.nil?
51
- fail WiceGridException.new("Cannot search for this column(#{column_name}) in a default model(#{@default_model_class}) as the default model is not set")
50
+ raise WiceGridException.new("Cannot search for this column(#{column_name}) in a default model(#{@default_model_class}) as the default model is not set")
52
51
  end
53
52
 
54
53
  self[@default_model_class][column_name]
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
  module Controller #:nodoc:
4
3
  def self.included(base) #:nodoc:
@@ -144,13 +143,13 @@ module Wice
144
143
  options.merge!(opts)
145
144
 
146
145
  [:attribute, :value].each do |key|
147
- fail ::Wice::WiceGridArgumentError.new("wice_grid_custom_filter_params: :#{key} is a mandatory argument") unless options[key]
146
+ raise ::Wice::WiceGridArgumentError.new("wice_grid_custom_filter_params: :#{key} is a mandatory argument") unless options[key]
148
147
  end
149
148
 
150
149
  attr_name = if options[:model]
151
150
  unless options[:model].nil?
152
151
  options[:model] = options[:model].constantize if options[:model].is_a? String
153
- fail Wice::WiceGridArgumentError.new('Option :model can be either a class or a string instance') unless options[:model].is_a? Class
152
+ raise Wice::WiceGridArgumentError.new('Option :model can be either a class or a string instance') unless options[:model].is_a? Class
154
153
  end
155
154
  options[:model].table_name + '.' + options[:attribute]
156
155
  else
@@ -171,7 +170,7 @@ module Wice
171
170
  end
172
171
 
173
172
  def send_file_rails2(path, options = {}) #:nodoc:
174
- fail "Cannot read file #{path}" unless File.file?(path) && File.readable?(path)
173
+ raise "Cannot read file #{path}" unless File.file?(path) && File.readable?(path)
175
174
 
176
175
  options[:length] ||= File.size(path)
177
176
  options[:filename] ||= File.basename(path) unless options[:url_based_filename]
@@ -194,7 +193,7 @@ module Wice
194
193
  def send_file_headers_rails2!(options) #:nodoc:
195
194
  options.update(DEFAULT_SEND_FILE_OPTIONS_RAILS2.merge(options))
196
195
  [:length, :type, :disposition].each do |arg|
197
- fail ArgumentError, ":#{arg} option required" if options[arg].nil?
196
+ raise ArgumentError, ":#{arg} option required" if options[arg].nil?
198
197
  end
199
198
 
200
199
  disposition = options[:disposition].dup || 'attachment'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
  module WgHash #:nodoc:
4
3
  class << self #:nodoc:
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
  class << self
4
3
 
@@ -124,11 +123,11 @@ module Wice
124
123
  # checks whether the class is a valid storage for saved queries
125
124
  def validate_query_model(query_store_model) #:nodoc:
126
125
  unless query_store_model.respond_to?(:list)
127
- fail ::Wice::WiceGridArgumentError.new("Model for saving queries #{query_store_model.class.name} is invalid - there is no class method #list defined")
126
+ raise ::Wice::WiceGridArgumentError.new("Model for saving queries #{query_store_model.class.name} is invalid - there is no class method #list defined")
128
127
  end
129
128
  arit = query_store_model.method(:list).arity
130
129
  unless arit == 2
131
- fail ::Wice::WiceGridArgumentError.new("Method list in the model for saving queries #{query_store_model.class.name} has wrong arity - it should be 2 instead of #{arit}")
130
+ raise ::Wice::WiceGridArgumentError.new("Method list in the model for saving queries #{query_store_model.class.name} has wrong arity - it should be 2 instead of #{arit}")
132
131
  end
133
132
  @@model_validated = true
134
133
  end
@@ -137,7 +136,7 @@ module Wice
137
136
  def get_query_store_model #:nodoc:
138
137
  query_store_model = Wice::ConfigurationProvider.value_for(:QUERY_STORE_MODEL)
139
138
  query_store_model = query_store_model.constantize if query_store_model.is_a? String
140
- fail ::Wice::WiceGridArgumentError.new('Defaults::QUERY_STORE_MODEL must be an ActiveRecord class or a string which can be constantized to an ActiveRecord class') unless query_store_model.is_a? Class
139
+ raise ::Wice::WiceGridArgumentError.new('Defaults::QUERY_STORE_MODEL must be an ActiveRecord class or a string which can be constantized to an ActiveRecord class') unless query_store_model.is_a? Class
141
140
  validate_query_model(query_store_model) unless @@model_validated
142
141
  query_store_model
143
142
  end
@@ -179,7 +178,7 @@ module Wice
179
178
  Wice::Defaults.const_get(key)
180
179
  else
181
180
  if strict
182
- fail WiceGridMissingConfigurationConstantException.new("Could not find constant #{key} in the configuration file!" \
181
+ raise WiceGridMissingConfigurationConstantException.new("Could not find constant #{key} in the configuration file!" \
183
182
  ' It is possible that the version of WiceGrid you are using is newer than the installed configuration file in config/initializers. ' \
184
183
  "Constant Wice::Defaults::#{key} is missing and you need to add it manually to wice_grid_config.rb or run the generator task=:\n" \
185
184
  ' rails g wice_grid:install')
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Wice
3
2
  class <<self
4
3
  # Used in routes.rb to define routes to the query processing controller.
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  class WiceGridSerializedQuery < ActiveRecord::Base #:nodoc:
3
2
  serialize :query
4
3
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'csv'
3
2
 
4
3
  module Wice
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'wice/wice_grid_misc.rb'
3
2
  require 'wice/wice_grid_core_ext.rb'
4
3
  require 'wice/grid_renderer.rb'
@@ -86,13 +85,13 @@ module Wice
86
85
  end
87
86
 
88
87
  unless @klass.is_a?(Class) && @klass.ancestors.index(ActiveRecord::Base)
89
- fail WiceGridArgumentError.new('ActiveRecord model class (second argument) must be a Class derived from ActiveRecord::Base')
88
+ raise WiceGridArgumentError.new('ActiveRecord model class (second argument) must be a Class derived from ActiveRecord::Base')
90
89
  end
91
90
 
92
91
  # validate :with_resultset & :with_paginated_resultset
93
92
  [:with_resultset, :with_paginated_resultset].each do |callback_symbol|
94
93
  unless [NilClass, Symbol, Proc].index(opts[callback_symbol].class)
95
- fail WiceGridArgumentError.new(":#{callback_symbol} must be either a Proc or Symbol object")
94
+ raise WiceGridArgumentError.new(":#{callback_symbol} must be either a Proc or Symbol object")
96
95
  end
97
96
  end
98
97
 
@@ -101,7 +100,7 @@ module Wice
101
100
  # validate :order_direction
102
101
  if opts[:order_direction] && ! (opts[:order_direction] == 'asc' || opts[:order_direction] == :asc || opts[:order_direction] == 'desc' ||
103
102
  opts[:order_direction] == :desc)
104
- fail WiceGridArgumentError.new(":order_direction must be either 'asc' or 'desc'.")
103
+ raise WiceGridArgumentError.new(":order_direction must be either 'asc' or 'desc'.")
105
104
  end
106
105
 
107
106
  begin
@@ -146,9 +145,9 @@ module Wice
146
145
  when Symbol
147
146
  @name = @name.to_s
148
147
  else
149
- fail WiceGridArgumentError.new('name of the grid should be a string or a symbol')
148
+ raise WiceGridArgumentError.new('name of the grid should be a string or a symbol')
150
149
  end
151
- fail WiceGridArgumentError.new('name of the grid can only contain alphanumeruc characters') unless @name =~ /^[a-zA-Z\d_]*$/
150
+ raise WiceGridArgumentError.new('name of the grid can only contain alphanumeruc characters') unless @name =~ /^[a-zA-Z\d_]*$/
152
151
 
153
152
  @table_column_matrix = TableColumnMatrix.new
154
153
  @table_column_matrix.default_model_class = @klass
@@ -225,24 +224,24 @@ module Wice
225
224
  # declare_column(String, ActiveRecord, CustomFilterSpec, nil | string, nil | Boolean)
226
225
  def declare_column(
227
226
  column_name: nil,
228
- model: nil,
229
- custom_filter_active: nil,
227
+ model: nil,
228
+ custom_filter_active: nil,
230
229
  table_alias: nil,
231
230
  filter_type: nil,
232
- assocs: []) #:nodoc:
231
+ assocs: []) #:nodoc:
233
232
 
234
233
 
235
234
  @options[:include] = Wice.build_includes(@options[:include], assocs)
236
235
 
237
236
  if model # this is an included table
238
237
  column = @table_column_matrix.get_column_by_model_class_and_column_name(model, column_name)
239
- fail WiceGridArgumentError.new("Column '#{column_name}' is not found in table '#{model.table_name}'!") if column.nil?
238
+ raise WiceGridArgumentError.new("Column '#{column_name}' is not found in table '#{model.table_name}'!") if column.nil?
240
239
  main_table = false
241
240
  table_name = model.table_name
242
241
  else
243
242
  column = @table_column_matrix.get_column_in_default_model_class_by_column_name(column_name)
244
243
  if column.nil?
245
- fail WiceGridArgumentError.new("Column '#{column_name}' is not found in table '#{@klass.table_name}'! " \
244
+ raise WiceGridArgumentError.new("Column '#{column_name}' is not found in table '#{@klass.table_name}'! " \
246
245
  "If '#{column_name}' belongs to another table you should declare it in :include or :join when initialising " \
247
246
  'the grid, and specify :model in column declaration.')
248
247
  end
@@ -322,7 +321,7 @@ module Wice
322
321
  def add_references(relation) #:nodoc:
323
322
  if @ar_options[:include] && relation.respond_to?(:references)
324
323
  # refs = [@ar_options[:include]] unless @ar_options[:include].is_a?(Array)
325
- relation = relation.references(* @ar_options[:include])
324
+ relation = relation.references(* @ar_options[:include])
326
325
  end
327
326
  relation
328
327
  end
@@ -508,13 +507,13 @@ module Wice
508
507
  # Returns the list of objects browsable through all pages with the current filters.
509
508
  # Should only be called after the +grid+ helper.
510
509
  def all_pages_records
511
- fail WiceGridException.new('all_pages_records can only be called only after the grid view helper') unless self.view_helper_finished
510
+ raise WiceGridException.new('all_pages_records can only be called only after the grid view helper') unless self.view_helper_finished
512
511
  resultset_without_paging_with_user_filters
513
512
  end
514
513
 
515
514
  # Returns the list of objects displayed on current page. Should only be called after the +grid+ helper.
516
515
  def current_page_records
517
- fail WiceGridException.new('current_page_records can only be called only after the grid view helper') unless self.view_helper_finished
516
+ raise WiceGridException.new('current_page_records can only be called only after the grid view helper') unless self.view_helper_finished
518
517
  @resultset
519
518
  end
520
519
 
@@ -557,7 +556,7 @@ module Wice
557
556
  elsif custom_order.is_a? Proc
558
557
  custom_order.call(fully_qualified_column_name)
559
558
  else
560
- fail WiceGridArgumentError.new("invalid custom order #{custom_order.inspect}")
559
+ raise WiceGridArgumentError.new("invalid custom order #{custom_order.inspect}")
561
560
  end
562
561
  end
563
562
  end
@@ -653,7 +652,7 @@ module Wice
653
652
  # create a Time instance out of parameters
654
653
  def params_2_datetime(par) #:nodoc:
655
654
  return nil if par.blank?
656
- params = [par[:year], par[:month], par[:day], par[:hour], par[:minute]].collect { |v| v.blank? ? nil : v.to_i }
655
+ params = [par[:year], par[:month], par[:day], par[:hour], par[:minute]].collect { |v| v.blank? ? nil : v.to_i }
657
656
  begin
658
657
  Time.local(*params)
659
658
  rescue ArgumentError, TypeError
@@ -664,7 +663,7 @@ module Wice
664
663
  # create a Date instance out of parameters
665
664
  def params_2_date(par) #:nodoc:
666
665
  return nil if par.blank?
667
- params = [par[:year], par[:month], par[:day]].collect { |v| v.blank? ? nil : v.to_i }
666
+ params = [par[:year], par[:month], par[:day]].collect { |v| v.blank? ? nil : v.to_i }
668
667
  begin
669
668
  Date.civil(*params)
670
669
  rescue ArgumentError, TypeError
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  ActiveRecord::Schema.define(version: 20150713103513) do
3
2
  create_table 'dummies', force: :cascade do |t|
4
3
  t.string 'name'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # This file was generated by the `rspec --init` command. Conventionally, all
3
2
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
4
3
  # The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'active_record'
3
2
 
4
3
  ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Default number of rows to show per page.
4
2
  Wice::Defaults::PER_PAGE = 20
5
3
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  describe Wice::GridOutputBuffer do
4
2
  FILTER_COMMON_CODE = 'here filter code'
5
3
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  describe Wice::TableColumnMatrix do
4
2
  let(:general_conditions){ 'conditions' }
5
3