Skip to content

Commit

Permalink
Revert "added in-memory adapter"
Browse files Browse the repository at this point in the history
This reverts commit 1079d70.

Conflicts:
	lib/wice/memory_adapter.rb
  • Loading branch information
leikind committed Feb 25, 2014
1 parent 26fda6e commit 831afd7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -15,5 +15,4 @@ rdoc
spec/reports
test/tmp
test/version_tmp
tmp
*~
tmp
1 change: 1 addition & 0 deletions lib/wice/wice_grid_controller.rb
Expand Up @@ -65,6 +65,7 @@ def save_wice_grid_queries
# can be changed in <tt>lib/wice_grid_config.rb</tt>, this is convenient if you want to set a project wide setting
# without having to repeat it for every grid instance.


def initialize_grid(klass, opts = {})
wg = WiceGrid.new(klass, self, opts)
self.wice_grid_instances = [] if self.wice_grid_instances.nil?
Expand Down
21 changes: 7 additions & 14 deletions lib/wice_grid.rb
Expand Up @@ -3,7 +3,6 @@
require 'wice/wice_grid_misc.rb'
require 'wice/wice_grid_core_ext.rb'
require 'wice/grid_renderer.rb'
require 'wice/memory_adapter.rb'
require 'wice/table_column_matrix.rb'
require 'wice/active_record_column_wrapper.rb'
require 'wice/helpers/wice_grid_view_helpers.rb'
Expand Down Expand Up @@ -64,22 +63,16 @@ class WiceGrid

# core workflow methods START

def initialize(klass_or_relation_or_memory_adapter, controller, opts = {}) #:nodoc:
def initialize(klass_or_relation, controller, opts = {}) #:nodoc:
@controller = controller

@relation = klass_or_relation_or_memory_adapter
if klass_or_relation_or_memory_adapter.is_a?(Wice::MemoryAdapter::MemoryAdapter)
@klass = klass_or_relation_or_memory_adapter.klass
elsif klass_or_relation_or_memory_adapter.is_a?(ActiveRecord::Relation)
@klass = klass_or_relation_or_memory_adapter.klass
else
@klass = klass_or_relation_or_memory_adapter
end
@relation = klass_or_relation
@klass = klass_or_relation.is_a?(ActiveRecord::Relation) ?
klass_or_relation.klass :
klass_or_relation

if not @klass.is_a?(Wice::MemoryAdapter::MemoryAdapterKlass)
unless @klass.kind_of?(Class) && @klass.ancestors.index(ActiveRecord::Base)
raise WiceGridArgumentError.new("Data model class must be a relation, memory adapter, or derived from active record")
end
unless @klass.kind_of?(Class) && @klass.ancestors.index(ActiveRecord::Base)
raise WiceGridArgumentError.new("ActiveRecord model class (second argument) must be a Class derived from ActiveRecord::Base")
end

# validate :with_resultset & :with_paginated_resultset
Expand Down

0 comments on commit 831afd7

Please sign in to comment.