Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7500213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:06:23+00:00 2026-05-29T20:06:23+00:00

I have an ActiveAdmin app with a simple model that I want to persist

  • 0

I have an ActiveAdmin app with a simple model that I want to persist in Elastic Search with Tire:

class Person
  include Tire::Model::Persistence

  property :firstName
  property :lastName
end

But I get this error on the index action:

NoMethodError (undefined method `quoted_table_name' for Person:Class)

What have I missed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:06:24+00:00Added an answer on May 29, 2026 at 8:06 pm

    First of all, I skipped a few steps enabling Tire persistence. Thanks to Chris Berkhout’s post on this topic my model now looks like this:

    class Person
      include Tire::Model::Persistence
      include Tire::Model::Search
      include Tire::Model::Callbacks
    
      index_name ES_INDEX_NAME
    
      # Refresh ES so any changes are immediately visible
      refresh = lambda { Tire::Index.new(ES_INDEX_NAME).refresh }
      after_save &refresh
      after_destroy &refresh
    
      property :firstName
      property :lastName
      property :updated_at
    
      before_save { |n| n.updated_at = Time.now }
    
      def self.touch_es
        # Ensure a mapping in a fresh index, so that Note.all can sort on updated_at
        n = Person.new
        n.save
        n.destroy
      end
    
      def self.all
        # Override so that Note.all comes back sorted on updated_at, rather than _id
        search { sort { by :updated_at, 'desc' } }
      end
    
      def self.q(q)
        search { sort { by :updated_at, 'desc' }; query { string q } }
      end
    
    end
    

    And I needed to add a es.rake task in lib/tasks to set up the index:

    namespace :es do
      desc "Delete the ElasticSearch index for the current environment"
      task :drop => :environment do
        Tire::Index.new(ES_INDEX_NAME).delete
      end
      desc "Create the ElasticSearch index for the current environment"
      task :create => :environment do
        Tire::Index.new(ES_INDEX_NAME).create
        Person.touch_es
      end
    end
    

    And an initializer es.rb in config/initializers to define the index name:

    ES_INDEX_NAME = "#{Rails.application.class.parent_name.downcase}_#{Rails.env}"
    

    Works a treat!

    As for trying to get ActiveAdmin working with ES persistence, I see that AA is tied to ActiveRecord, though ActiveModel or an ORM-independent version is in the works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails app that is using Devise, with a User model, no
Have a n-tire web application and search often times out after 30 secs. How
I currently have a Rails 3.0.10 app and I made two models with simple
I'm using active admin for my rails app. I have a customer model which
I have a model called user. I want to show the password field just
Have an app that can use tts to read text messages. It can also
I'm trying to customise a ActiveAdmin form for a Recipe model that has a
I have an ActiveAdmin app. When the user logs in, it is taken to
I'm using ActiveAdmin and Formtastic. I have an invoice form that has a drop
I just implemented the ActiveAdmin gem with my Rails 3.1 app, and it caused

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.