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

  • Home
  • SEARCH
  • 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 6621947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:20:21+00:00 2026-05-25T21:20:21+00:00

My model has this scope scope :supported, order(name).collect {|m| m.name}.join(, ) and it throws

  • 0

My model has this scope

  scope :supported, order("name").collect {|m| m.name}.join(", ") 

and it throws an error

NoMethodError: undefined method `includes_values' for "blah, blahblah":String

I’m thinking that it’s because I’m trying to return a string as an ActiveRecord object, thoughts on how to fix it? Actually I have this code already working in the view but thought it might be better in the model, maybe not?

EDIT
Moving it into a non-scope class method works

def supported
  order("name").collect {|m| m.name}.join(", ") 
end

Here’s a related question that better clarifies the difference between scope vs. self class methods.

  • 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-25T21:20:22+00:00Added an answer on May 25, 2026 at 9:20 pm

    what are you trying to do exactly?, if you want to return a string, use class methods. if you want to define a chainable ARel scope, well i’d always recommend to use class methods too, but some prefer the “explicit” way via scope.

    def self.supported
      order('name').to_a * ", "
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model that holds user address. This model has to have first_name
My Invoice model has an address_id attribute, and I don't want this address_id to
Specifically, I have a model that has a field like this pub_date = models.DateField(date
I have a problem. Imagine this data model: [Person] table has: PersonId, Name1 [Tag]
I have a class that contains data from some model. This class has metadata
I have a model, Feed, that has and belongs to many FilteredUsers. In this
I bet this has a simple answer.. Let's say I have a Post model
I have a Model Category which has name:string categoryId:integer parent_id:integer the categoryId doesnt matter
So, I have the following scope in my Photo model: scope :best, order(:average_rating.desc) The
ViM has this option hlsearch where a searched string is displayed in highlight mode

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.