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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:05:46+00:00 2026-05-23T16:05:46+00:00

So here is a object I retrieved from the ActiveRecord other = [#<Referrer id:

  • 0

So here is a object I retrieved from the ActiveRecord other = [#<Referrer id: 16, name: "Other", published: true, created_at: "2011-07-11 16:22:00", updated_at: "2011-07-11 16:22:00">]

Why can’t I do other.created_at while I can do other.name?

Here is the model:

class Referrer < ActiveRecord::Base
end

The error I’m getting:

NoMethodError: undefined method `created_at' for #<ActiveRecord::Relation:0x1035763c8>

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-23T16:05:47+00:00Added an answer on May 23, 2026 at 4:05 pm

    If you’ll notice, other is actually an ActiveRecord::Relation which basically means it’s acting like an array of Referrer objects. So you can’t just call created_at on it. You could call other.first.created_at or if you want an array of created_at dates you could do other.map(&:created_at).

    The reason you can call other.name is because an ActiveRecord::Relation responds to name. But it’s a different name method than the name attribute on your Referrer model. other.name should return "Referrer" instead of "Other" right?

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

Sidebar

Related Questions

I have a XML String retrieved from a XML file. I can't access the
Here's my binding source object: Public Class MyListObject Private _mylist As New ObservableCollection(Of String)
Here is my SQLCommand object: oCommand.CommandText = INSERT INTO hits (id,client_id,client_ip,page,vars) VALUES _ (@@IDENTITY,@client_id,@ip,@page,@vars)
Here's the thing: object[] arrayText = new object[1]; if (arrayText[1] == null) { MessageBox.Show(Is
here is what a I'm doing: object ReturnMatch(System.Type type) { foreach(object obj in myObjects)
Here is my function: private void btnSave_Click(object sender, EventArgs e) { wO_FlangeMillBundlesTableAdapter.Update(invClerkDataDataSet.WO_FlangeMillBundles); wO_HeadMillBundlesTableAdapter.Update(invClerkDataDataSet.WO_HeadMillBundles); wO_WebMillBundlesTableAdapter.Update(invClerkDataDataSet.WO_WebMillBundles);
Here is the scenario: I have an object called a Transaction that needs to
Here's the scenario-- you've got a JSON object on the browser, and let's say
Here is what I am trying to do: 1) Open an ofstream object in
Here’s my code behind: protected void gvviewapproval_RowUpdated(object sender, GridViewUpdatedEventArgs e) { using (SqlConnection cn

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.