Rails: activeadmin, undefined method `per' for #<ActiveRecord::Relation:0x4d15ee0> -
i installed activeadmin successfully:
my gemfile code:
source 'https://rubygems.org'
gem 'rails', '3.2.10' # bundle border rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # gems used assets , not required # in production environments default. grouping :assets gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' # see https://github.com/sstephenson/execjs#readme more supported runtimes # gem 'therubyracer', :platforms => :ruby gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails' gem 'twitter-bootstrap-rails' gem 'activeadmin' # gem "meta_search", '>= 1.1.0.pre' gem "spud_photos" gem 'devise' gem 'cancan' gem 'rolify'
and did this:
bundle rails g active_admin:install rake db:migrate rails g active_admin:resource product
i linked models activeadmin.
error after clicking in dashboard on product link:
undefined method `per' #<activerecord::relation:0x4d15ee0>
active admin need kaminari pagination if want utilize paginate, can create alias paginate functions match kaminari one:
# config/initializers/will_paginate.rb if defined?(willpaginate) module willpaginate module activerecord module relationmethods alias_method :per, :per_page alias_method :num_pages, :total_pages end end end end module activerecord class relation alias_method :total_count, :count end end
and 1 worked me.
activeadmin
No comments:
Post a Comment