I see the above issue while accessing active admin show page for model "campaign". This might be due to friendly_id gem, but I'm unable to identify what exactly the issue is. My campaign.rb file looks like following:
class Campaign < ApplicationRecord
extend FriendlyId
friendly_id :title, use: [:slugged, :history]
belongs_to :appeal
belongs_to :user
has_many :donations, dependent: :destroy
has_many :slugs, class_name: "FriendlyId::Slug", as: :sluggable, dependent: :destroy
validates :title, presence: true
validates :description, presence: true
validates :appeal_id, uniqueness: { scope: :user_id }
def normalize_friendly_id(value)
value.to_s.parameterize(preserve_case: true)
end
def self.first_by_friendly_id(id)
super(id.split("-").map(&:capitalize).join("-"))
end
private
def should_generate_new_friendly_id?
slug.blank? || title_changed?
end
end
and "campaigns.rb" contains:
ActiveAdmin.register Campaign do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# Uncomment all parameters which should be permitted for assignment
#
permit_params :title, :description, :appeal_id, :user_id, :slug
#
# or
#
# permit_params do
# permitted = [:title, :description, :appeal_id, :user_id, :slug]
# permitted << :other if params[:action] == 'create' && current_user.admin?
# permitted
# end
end