Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharding data does not work. #349

Open
yeomcda opened this issue Jul 7, 2017 · 4 comments
Open

Sharding data does not work. #349

yeomcda opened this issue Jul 7, 2017 · 4 comments

Comments

@yeomcda
Copy link

yeomcda commented Jul 7, 2017

Hi! leikind.
Nice to meet you.
There is one issue.
Sharding data does not work.
I am sharding data using an octopus gem.
How do I get it to run? Please help me

My gem version info:
rails (4.2.6)
ar-octopus (0.8.6)
wice_grid (3.6.2)

This is my code:
Controller def index
# using method in octopus gem
grid_data = Model.using(:shard_name).where(id: 1)
@grid = initialize_grid(grid_data)

View index
<%= grid(@grid) do |g|
g.column name: "name" do |data|
data.id
end
end -%>

error log:

Wice::WiceGridArgumentError (WiceGrid: ActiveRecord model class (second argument) must be a Class derived from ActiveRecord::Base):
app/controllers/game/character_controller.rb:10:in `index'

Rendered /Users/yeomcda/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_source.erb (5.0ms)
Rendered /Users/yeomcda/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.4ms)
Rendered /Users/yeomcda/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.8ms)
Rendered /Users/yeomcda/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (65.8ms)

@yeomcda yeomcda changed the title Sharded records do not grid. Sharding data does not work. Jul 7, 2017
@leikind
Copy link
Owner

leikind commented Jul 7, 2017

what does puts grid_data.class say?

@yeomcda
Copy link
Author

yeomcda commented Jul 7, 2017

Thats Model::ActiveRecord_Relation
I found one thing.
@grid = initialize_grid(grid_data.klass)
It is work!!

@leikind
Copy link
Owner

leikind commented Jul 7, 2017

what is the version of the plugin?

initialize_grid(grid_data.klass) makes everything you did before useless (Model.using(:shard_name).where(id: 1))

@yeomcda
Copy link
Author

yeomcda commented Jul 10, 2017

This my project gem list.

Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types-data 3.2016.0221
Using arel 6.0.3
Using execjs 2.6.0
Using bcrypt 3.1.11
Using debug_inspector 0.0.2
Using sass 3.4.22
Using byebug 9.0.0
Using cancan 1.6.10
Using coffee-script-source 1.10.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using orm_adapter 0.5.0
Using devise-i18n 1.0.1
Using multi_json 1.12.0
Using mysql2 0.4.4
Using bundler 1.12.5
Using raphael-rails 2.1.2
Using tilt 2.0.3
Using spring 1.7.1
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using warden 1.2.6
Using passenger 5.0.28
Using mime-types 3.0
Using autoprefixer-rails 6.3.6
Using uglifier 3.0.0
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using sprockets 3.6.0
Using sdoc 0.4.1
Using activesupport 4.2.6
Using loofah 2.0.3
Using mail 2.6.4
Using bootstrap-sass 3.3.6
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Using jbuilder 2.4.1
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using actionview 4.2.6
Using ar-octopus 0.8.6
Using actionpack 4.2.6
Using actionmailer 4.2.6
Using railties 4.2.6
Using kaminari 0.17.0
Using sprockets-rails 3.0.4
Using simple_form 3.2.1
Using coffee-rails 4.1.1
Using responders 2.2.0
Using font-awesome-rails 4.6.2.0
Using jquery-rails 4.1.1
Using jquery-ui-rails 5.0.5
Using morrisjs-rails 0.5.1
Using rails-i18n 4.0.8
Using rails 4.2.6
Using sass-rails 5.0.4
Using web-console 2.3.0
Using turbolinks 2.5.3
Using wice_grid 3.6.2
Using devise 4.1.0
Using jquery-turbolinks 2.1.0

It is not work.
@grid = initialize_grid(grid_data)

but this code work.
@grid = initialize_grid(grid_data.klass)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants