Closed omerozturk0 closed 6 years ago
searchkiick
doesn't currently support a chained scopes like in rails: User.where(..).where(...).joins(...).limit(...).order(...)
. It makes it incompatible with datagrid phylosophy so far...
Thanks for reply. 👍 But ActiveRecord supporting hash conditions like searchkick. How can i do it with hash conditions? Or is this possible?
You may try to power hack it like this:
class Grid
scope { [] }
dynamic do
scope do
User.search(query, where: where_conditions, page: page)
end
end
filter(:page, :integer)
filter(:query, :string)
filter(:one, ...)
filter(:two, ...)
def where_conditions
attributes.slice(:one, :two)
end
end
I'm using like this:
class UsersGrid < BaseGrid
scope { [] }
dynamic do
scope do
User.search(
attributes[:query],
fields: %i[full_name email mobile],
match: :word_start,
where: where_conditions,
misspellings: false,
page: attributes[:page]
)
end
end
filter(:query, :string, header: 'Ara')
filter(:created_at, :date, :range => true, header: 'Ekleme Tarihi')
column_names_filter(:header => "Opsiyonel", checkboxes: true)
column(:id, header: 'ID')
column(:full_name, mandatory: true, header: 'Ad & Soyad')
column(:mobile, header: 'Telefon')
column(:tc, header: 'T.C.')
column(:groups, header: 'Etüt Grupları') { |record| record.groups.join(', ') }
column(:activated, header: 'Aktif') { |record| record.active? ? 'Evet' : 'Hayır' }
date_column(:created_at, mandatory: true, header: 'Ekleme Tarihi')
date_column(:updated_at, header: 'Güncelleme Tarihi')
column(:actions, mandatory: true, html: true, header: 'İşlemler') do |record|
render 'users/links', user: record
end
private
def where_conditions
attributes.slice(:created_at).reject!{|k,v| v.blank?}
end
end
But I still getting this error: "undefined method `total_count' for []:Array"
If i change scope { [] }
to scope { User }
then I getting other error like this: "undefined column users.query"
Note: I'm using kaminari for pagination.
Add attr_accessor :page
and ensure you pass it into grid constructor in controller, like:
Grid.new(params[:grid].merge(page: params[:page] || 1)
and change the page option line:
page: page #instead of attributes[:page]
Same error. 😔
Can you show me the controller code and the line of code where the exception occurs?
This is my UsersGrid.rb:
UserController#index:
Error:
Top lvel Scope is incorrect: scope { User }
. Should be: scope { [] }
Should I add attr_accessor :query
and pass query parameter in controller like this?
UsersGrid.new(grid_params.merge(page: params[:page], query: params[:query]))
No, you should not. I can not be guessing about your problem....you should give me the whole picture: grid, controller, view and exception (including backtrace); or investigate the problem yourself.
Sorry for late reply. Im sharing my codes.
UsersController:
class UsersController < ApplicationController
load_and_authorize_resource
include NecessaryActions
# GET /users
# GET /users.json
def index
@grid = UsersGrid.new(grid_params.merge(page: params[:page]))
respond_to do |format|
format.html
format.csv do
send_data @grid.to_csv, type: "text/csv", disposition: 'inline', filename: "#{@grid.assets.model_name.human}-#{Time.zone.now.strftime("%Y-%m-%d-%H-%M-%S")}.csv"
end
format.xlsx do
response.headers['Content-Disposition'] = 'attachment; filename="ogrenciler.xlsx"'
end
end
end
protected
def grid_params
params.fetch(:users_grid, {}).permit!
end
end
UsersGrid:
class UsersGrid < BaseGrid
attr_accessor :page
scope { [] }
dynamic do
scope do
User.search(
attributes[:query],
fields: %i[full_name email mobile],
match: :word_start,
misspellings: false
).records.page(page)
end
end
filter(:query, :string, header: 'Ara')
filter(:created_at, :date, :range => true, header: 'Ekleme Tarihi')
column_names_filter(:header => "Opsiyonel", checkboxes: true)
column(:id, header: 'ID')
column(:full_name, mandatory: true, header: 'Ad & Soyad')
column(:mobile, header: 'Telefon')
column(:tc, header: 'T.C.')
column(:groups, header: 'Etüt Grupları') { |record| record.groups.join(', ') }
column(:activated, header: 'Aktif') { |record| record.active? ? 'Evet' : 'Hayır' }
date_column(:created_at, mandatory: true, header: 'Ekleme Tarihi')
date_column(:updated_at, header: 'Güncelleme Tarihi')
column(:actions, mandatory: true, html: true, header: 'İşlemler') do |record|
render 'users/links', user: record
end
private
def where_conditions
attributes.slice(:created_at).reject!{|k,v| v.blank?}
end
end
users/index.html.erb:
<%= datagrid_form_for @grid, :method => :get, :url => users_path %>
<%= datagrid_table @grid, html: { class: 'table table-striped' } %>
<%= paginate(@grid.assets) %>
This working normally after use datagrid filter. But if i use datagrid filter im getting this error.
undefined method `total_count' for []:Array
Please add the full backtrace of the exception
This is my user.rb file:
class User < ApplicationRecord
has_many :etude_participants, dependent: :destroy
has_many :punishments, as: :punishable
searchkick word_start: %i[full_name email mobile]
scope :active, -> { where(active: true) }
scope :order_desc, -> { order(created_at: :desc) }
end
I'm adding %i[full_name email mobile]
this fields index for elastic search.
Showing /Users/omer/Documents/code/rails/ekare_admin/app/views/users/index.html.erb where line #2 raised:
undefined method `query' for #<User:0x007fc2d907a050>
Did you mean? to_query
activemodel (5.1.4) lib/active_model/attribute_methods.rb:432:in `method_missing'
datagrid (1.5.8) lib/datagrid/drivers/array.rb:15:in `block in where'
activerecord (5.1.4) lib/active_record/relation/delegation.rb:39:in `each'
activerecord (5.1.4) lib/active_record/relation/delegation.rb:39:in `each'
activerecord (5.1.4) lib/active_record/relation/query_methods.rb:248:in `select'
activerecord (5.1.4) lib/active_record/relation/query_methods.rb:248:in `select'
datagrid (1.5.8) lib/datagrid/drivers/array.rb:14:in `where'
datagrid (1.5.8) lib/datagrid/filters/base_filter.rb:143:in `default_filter_where'
datagrid (1.5.8) lib/datagrid/filters/ranged_filter.rb:51:in `default_filter_where'
datagrid (1.5.8) lib/datagrid/filters/base_filter.rb:180:in `default_filter'
datagrid (1.5.8) lib/datagrid/filters/base_filter.rb:111:in `block in default_filter_block'
datagrid (1.5.8) lib/datagrid/utils.rb:80:in `apply_args'
datagrid (1.5.8) lib/datagrid/filters/base_filter.rb:150:in `execute'
datagrid (1.5.8) lib/datagrid/filters/base_filter.rb:26:in `apply'
datagrid (1.5.8) lib/datagrid/filters.rb:206:in `block in apply_filters'
datagrid (1.5.8) lib/datagrid/filters.rb:205:in `each'
datagrid (1.5.8) lib/datagrid/filters.rb:205:in `inject'
datagrid (1.5.8) lib/datagrid/filters.rb:205:in `apply_filters'
datagrid (1.5.8) lib/datagrid/filters.rb:151:in `assets'
datagrid (1.5.8) lib/datagrid/columns.rb:228:in `assets'
datagrid (1.5.8) lib/datagrid/ordering.rb:43:in `assets'
datagrid (1.5.8) lib/datagrid/renderer.rb:41:in `table'
datagrid (1.5.8) lib/datagrid/helper.rb:42:in `datagrid_table'
actionview (5.1.4) lib/action_view/template.rb:157:in `block in render'
activesupport (5.1.4) lib/active_support/notifications.rb:168:in `instrument'
actionview (5.1.4) lib/action_view/template.rb:352:in `instrument_render_template'
actionview (5.1.4) lib/action_view/template.rb:155:in `render'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:52:in `block (2 levels) in render_template'
actionview (5.1.4) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `instrument'
actionview (5.1.4) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:51:in `block in render_template'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:59:in `render_with_layout'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:50:in `render_template'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (5.1.4) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (5.1.4) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.1.4) lib/action_view/rendering.rb:103:in `_render_template'
actionpack (5.1.4) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (5.1.4) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (5.1.4) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (5.1.4) lib/action_controller/metal/renderers.rb:141:in `render_to_body'
actionpack (5.1.4) lib/abstract_controller/rendering.rb:24:in `render'
actionpack (5.1.4) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (5.1.4) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/omer/.rbenv/versions/2.4.0/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
activesupport (5.1.4) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
searchkick (2.4.0) lib/searchkick/logging.rb:214:in `cleanup_view_runtime'
activerecord (5.1.4) lib/active_record/railties/controller_runtime.rb:29:in `cleanup_view_runtime'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:43:in `render'
actionpack (5.1.4) lib/action_controller/metal/implicit_render.rb:33:in `default_render'
actionpack (5.1.4) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action'
actionpack (5.1.4) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap'
actionpack (5.1.4) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.1.4) lib/abstract_controller/base.rb:186:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.1.4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.1.4) lib/active_support/callbacks.rb:131:in `run_callbacks'
actionpack (5.1.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `instrument'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
searchkick (2.4.0) lib/searchkick/logging.rb:209:in `process_action'
activerecord (5.1.4) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.4) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.4) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.4) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.4) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:834:in `call'
serviceworker-rails (0.5.5) lib/serviceworker/middleware.rb:32:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.3) lib/rack/etag.rb:25:in `call'
rack (2.0.3) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.3) lib/rack/head.rb:12:in `call'
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.4) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.4) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.4) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
request_store (1.3.2) lib/request_store/middleware.rb:9:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
railties (5.1.4) lib/rails/engine.rb:522:in `call'
puma (3.10.0) lib/puma/configuration.rb:225:in `call'
puma (3.10.0) lib/puma/server.rb:605:in `handle_request'
puma (3.10.0) lib/puma/server.rb:437:in `process_client'
puma (3.10.0) lib/puma/server.rb:301:in `block in run'
puma (3.10.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Showing /Users/omer/Documents/code/rails/ekare_admin/app/views/users/index.html.erb where line #3 raised:
undefined method `total_pages' for []:Array
kaminari-core (1.1.1) lib/kaminari/helpers/helper_methods.rb:22:in `paginate'
actionview (5.1.4) lib/action_view/template.rb:157:in `block in render'
activesupport (5.1.4) lib/active_support/notifications.rb:168:in `instrument'
actionview (5.1.4) lib/action_view/template.rb:352:in `instrument_render_template'
actionview (5.1.4) lib/action_view/template.rb:155:in `render'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:52:in `block (2 levels) in render_template'
actionview (5.1.4) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `instrument'
actionview (5.1.4) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:51:in `block in render_template'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:59:in `render_with_layout'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:50:in `render_template'
actionview (5.1.4) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (5.1.4) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (5.1.4) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.1.4) lib/action_view/rendering.rb:103:in `_render_template'
actionpack (5.1.4) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (5.1.4) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (5.1.4) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (5.1.4) lib/action_controller/metal/renderers.rb:141:in `render_to_body'
actionpack (5.1.4) lib/abstract_controller/rendering.rb:24:in `render'
actionpack (5.1.4) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (5.1.4) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/omer/.rbenv/versions/2.4.0/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
activesupport (5.1.4) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
searchkick (2.4.0) lib/searchkick/logging.rb:214:in `cleanup_view_runtime'
activerecord (5.1.4) lib/active_record/railties/controller_runtime.rb:29:in `cleanup_view_runtime'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:43:in `render'
actionpack (5.1.4) lib/action_controller/metal/implicit_render.rb:33:in `default_render'
actionpack (5.1.4) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action'
actionpack (5.1.4) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap'
actionpack (5.1.4) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.1.4) lib/abstract_controller/base.rb:186:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.1.4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.1.4) lib/active_support/callbacks.rb:131:in `run_callbacks'
actionpack (5.1.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `instrument'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
searchkick (2.4.0) lib/searchkick/logging.rb:209:in `process_action'
activerecord (5.1.4) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.4) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.4) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.4) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.4) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:834:in `call'
serviceworker-rails (0.5.5) lib/serviceworker/middleware.rb:32:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.3) lib/rack/etag.rb:25:in `call'
rack (2.0.3) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.3) lib/rack/head.rb:12:in `call'
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.4) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.4) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.4) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
request_store (1.3.2) lib/request_store/middleware.rb:9:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
railties (5.1.4) lib/rails/engine.rb:522:in `call'
puma (3.10.0) lib/puma/configuration.rb:225:in `call'
puma (3.10.0) lib/puma/server.rb:605:in `handle_request'
puma (3.10.0) lib/puma/server.rb:437:in `process_client'
puma (3.10.0) lib/puma/server.rb:301:in `block in run'
puma (3.10.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
You need to add the dummy
option to filters to fix undefined method query
error:
filter(:query, :string, header: 'Ara', dummy: true)
filter(:created_at, :date, :range => true, header: 'Ekleme Tarihi', dummy: true)
undefined method total_pages
can probably be fixed with:
<% if @grid.assets.any? %>
<%= paginate(@grid.assets) %>
<% end %>
Thanks. It works.
Hi,
I want to filter with searchkick gem. This is possible? How can i do it?