I installed ActiveAdmin successfully:
My gemfile code:
source 'https://rubygems.org'
gem 'rails', '3.2.10'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for 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 i did this:
bundle
rails g active_admin:install
rake db:migrate
rails g active_admin:resource product
I linked some models to ActiveAdmin.
Error after clicking in the dashboard on the product link:
undefined method `per' for #<ActiveRecord::Relation:0x4d15ee0>
Active Admin need kaminari pagination If you want to use will paginate, you can make alias for will paginate functions to 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 this one worked for me.
This one helped me:
if defined?(WillPaginate)
ActiveSupport.on_load :active_record do
module WillPaginate
module ActiveRecord
module RelationMethods
def per(value = nil) per_page(value) end
def total_count() count end
end
end
module CollectionMethods
alias_method :num_pages, :total_pages
end
end
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With