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

Related Questions

I am trying to debug the user object created by writing ruby code like
I'm trying to debug a problem on a remote user's site. We've narrowed it
I'm trying to debug a bunch of functions that redirect the user. I want
I am trying to debug a problem where a user clicks on the button
I simplified the code a little while trying to debug: [HttpPost] public ActionResult Register(User
I am having real problems trying debug my code to malfunctioning print statements. I
When trying to debug a program on Windows I can't seem to find where
I'm trying to debug an old VB6 program at my job. It's full of
I'm trying to debug a web page that makes heavy use of events, and
I'm trying to debug this problem but not sure where exactly i need to

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.