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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:20:29+00:00 2026-05-13T06:20:29+00:00

I was trying to debug why <%= @user.address1 %> wasn’t showing up in the

  • 0

I was trying to debug why <%= @user.address1 %> wasn’t showing up in the view. The associated column was setup as a string, as in:

t.string   "address1"
t.string   "address2"
t.string   "city"
t.string   "state"
t.string   "zip"
t.string   "phone"

When I debugged the model using debug(@user), I got:

address1: 123 Main St.
city: Santa Barbara
address2: ""
zip: "93101"
state: CA

Associated view for inputting info into the db:

    <tr>
        <td width="300">Address: </td>
        <td><%= u.text_field :address1 %><br></td>
    </tr>
    <tr>
        <td width="300">Address2: </td>
        <td><%= u.text_field :address2 %><br></td>
    </tr>
    <tr>
        <td>City:</td>
        <td><%= u.text_field :city %></td>
    </tr>
    <tr>
        <td>State:</td>
        <td><%= u.text_field :state %></td>
    </tr>
    <tr>
        <td>Zip Code:</td>
        <td><%= u.text_field :zip %></td>
    </tr>
    <tr>
        <td>Phone:</td>
        <td><%= u.text_field :phone %></td>
    </tr>

I fixed the problem by using <%= @user.address1.to_s %> but from the debug output along with the schema I thought the column was already a string. I did notice that while the zip code contained quotations around it designating a string, the address1 did not.

So why couldn’t I initially use <% =@user.address1 %> without converting it to string? What kind of variable is the 123 main st. without quotations?

  • 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-13T06:20:29+00:00Added an answer on May 13, 2026 at 6:20 am

    The debug helper only uses quotes when they’re necessary to show a value is a string. It puts quotes around the zip so you know it’s not a number, and "" for address2 so you know it’s not nil. The rest are clearly strings. I don’t love this behavior, but this is how it works.

    So, since your @user.address1 was already a string, why wasn’t it appearing until you added to_s? I’m not sure. From what I can see it looks like it should. Could you maybe post some code from the view that displays it? What if you try <%=h @user.address1 %>? If you view the HTML source of the page, is anything there?

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

Sidebar

Ask A Question

Stats

  • Questions 256k
  • Answers 256k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is one of those situations where LINQ to SQL… May 13, 2026 at 10:27 am
  • Editorial Team
    Editorial Team added an answer You need to capture the event of the Ctrl key… May 13, 2026 at 10:27 am
  • Editorial Team
    Editorial Team added an answer lg N stands for the logarithm of N. It is… May 13, 2026 at 10:27 am

Related Questions

I'm trying to send an email to an external address as part of a
I am having a hard time figuring out why when the cfquery runs in
I'm trying do to a basic bash with the use of system calls but
I was trying to debug a sorting issue with the jquery plugin tablesorter which
I'm currently trying to debug a customer's issue with an FTP upload feature in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.