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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:44:39+00:00 2026-05-25T11:44:39+00:00

In my Rails 3 project I have three models: Projects has_many Feeds, and Feeds

  • 0

In my Rails 3 project I have three models: Projects has_many Feeds, and Feeds has_many XML_Fields. I have an entry in the Projects table with :name = “TestProject”. I am running a script located in /app/ using rails runner, and I am trying to access the database entries with ActiveRecord:

class Testing < ActiveRecord::Base

project = Project.find_by_name("TestProject")
puts project
end

Whether I use find_by_name, find, where, or whatever, my results always end up looking like:

#<Project:0x00000102b30ad0>

How do I get ActiveRecord to return the actual contents of that db entry (e.g. I want it to put “TestProject”)?

  • 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-25T11:44:40+00:00Added an answer on May 25, 2026 at 11:44 am

    Your output is perfectly fine. You are simply getting inspect output for your model. You have two options to get the desired output:

    puts project.name
    

    or redefine to_s:

    def to_s
      name
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three models: class User < ActiveRecord::Base has_many :projects, :through => :permissions class
I have a three-level multi-nested form in Rails. The setup is like this: Projects
I have a join table with three columns. I've tried defining the three models
I have a simple rails app with models project and phase. A project has
In my Rails application, I have two models, Articles and Projects, which are both
I have a number of models in a Rails project that are linked to
I have the following two models: class PhotoAlbum < ActiveRecord::Base belongs_to :project has_many :photos,
I have a Rails 3 project with Product. :product has_many :product_properties :product has_many :properties,
I have a rails 3.2 project. There are a bid object and i want
In my Rails project I have the following code: auto_link( h( wrap_long_string(post.text,50) )).gsub(/\n/,<br />)

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.