Meliborn
Meliborn

Reputation: 6645

Manage acts_as_taggable tags with activeadmin

Is it possible? I trying:

ActiveAdmin.register ActsAsTaggableOn::Tag do

end

But i'm getting an error:

undefined method `per_page_kaminari' for ActsAsTaggableOn::Tag(id: integer, name: string, info: text):Class`

Upvotes: 1

Views: 1703

Answers (1)

rmagnum2002
rmagnum2002

Reputation: 11421

try it with:

ActiveAdmin.register ActsAsTaggableOn::Tag.class_eval do
  ....
end

in admin/tags.rb, also if you have will_paginate in your Gemfile you'll need this

#fix for active_admin
Kaminari.configure do |config|
  config.page_method_name = :per_page_kaminari
end

put it in config/initializers/kaminari.rb , name of the file doesn't matter. Restart app.

Edit - another idea:

acts_as_tagable creates a table tags,

so you just create a model tag.rb in app/models

class Tag < ActiveRecord::Base
end

and in app/admin/tags.rb:

ActiveAdmin.register Tag do
end

I have used it this way and it works, can't show you the admin table. :) will post a screenshot soon.

enter image description here

Upvotes: 6

Related Questions