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 7063341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:42:08+00:00 2026-05-28T04:42:08+00:00

I am using the Ancestry Gem and I am getting an undefined method arrange

  • 0

I am using the Ancestry Gem and I am getting an undefined method "arrange" for #<Array:0x007f8d58e58700> error with the following code:

<%= @shipmgr_carriers.arrange(:order => :name) %>

However, When I just output @shipmgr_carriers I get an array with ancestry:

[#<Shipmgr::Carrier id: 9, name: "testing", status: nil, created_at: "2012-01-16 22:44:28", updated_at: "2012-01-16 22:44:28", ancestry: nil>, #<Shipmgr::Carrier id: 10, name: "test", status: nil, created_at: "2012-01-16 22:44:28", updated_at: "2012-01-16 22:44:28", ancestry: "9">] 

Can anyone tell me why I am unable to call the .arrange method on the array variable?

  • 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-28T04:42:09+00:00Added an answer on May 28, 2026 at 4:42 am

    I haven’t used Ancestry but it looks like it adds the arrange method to ActiveRecord::Base. It doesn’t add this method to Array and so you shouldn’t expect it to work on an array.

    I’m assuming you’re declaring @shipmgr_carriers in your controller something like this:

    class SomeController < ActionController::Base
      def some_action
        @shimgr_carriers = SomeModel.find(...).carriers
      end
    end
    

    Try this instead:

    def some_action
      @shipmgr_carriers = SomeModel.find(...).carriers
    
      @shipmgr_carriers_arranged = @shipmgr_carriers.arrange(...)
    end
    

    My hunch is that by the time @shipmgr_carriers gets to your view the query has already been run, transforming it into an array of results instead of a relation.

    This is logic that should probably be done in the controller anyway, so moving it out of the view is a good idea regardless.

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

Sidebar

Related Questions

I'm using the ancestry gem to help organise my app's tree structure in the
So I'm using the excellent Ancestry gem But while the documentation seems very complete
I am new to rails, I am using the ancestry gem and I am
I have ancestry for my category model. Im using slug gem. Currently i have
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
I'd like to check ancestry using two jQuery objects. They don't have IDs, and
I have been working on implementing the Ancestry gem in my rails app, I
I've just started using Ancestry instead of awesome_nested_set and I would like to create
I have a threaded Post using Ancestry. When replying to a Post from another
Using Java Reflection, is it possible to get the name of a local variable?

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.