I’m using activeadmin and for whatever reason it’s not like my Tag model. I don’t see anything out of the ordinary about it? google hasnt proved helpful
application_controller
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :get_tags
private
def get_tags
@tags = Tag.all
end
end
tags_controller
class TagsController < ApplicationController
def search
@tags = Tag.where("name like ?", "%#{params[:q]}%")
respond_to do |format|
format.json { render :json => @tags.to_json(:only => [:id, :name]) }
end
end
def show
@tag = Tag.find(params[:id])
@title = @tag.name
end
end
tag model
class Tag < ActiveRecord::Base
self.include_root_in_json = false
has_many :resource_tags
has_many :resources, :through => :resource_tags
attr_accessible :name
validates :name, :presence => true,
:length => { :within => 2..20 },
:uniqueness => { :case_sensitive => false }
end
full trace: http://pastie.org/3641717
I’m going to go out on a limb and guess that your
Tagmodel is conflicting with ActiveAdminsArbre::HTML::Tagclass. There may be other/better solutions, but one thing that’s worked for me in the past is to use theas:option in ActiveAdmin.Obviously, the change in copy might be ideal, but it’s a good troubleshooting step. Another option is to rename your
Tagmodel, or try namespacing it.