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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:40:50+00:00 2026-05-11T03:40:50+00:00

This is one of those things, that maybe so simple I’ll never find it

  • 0

This is one of those things, that maybe so simple I’ll never find it because everyone else already knows it.

I’ve got objects I have to check for nil in my views so I don’t dereference a nil:

<%= if tax_payment.user; tax_payment.user.name; end %> 

Or I could do this variant:

<%= tax_payment.user ? tax_payment.user.name : '' %> 

So this is ok … for most languages. But I feel like there must be some bit of shiny ruby or railness I’m still missing if this is the best I can do.

  • 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. 2026-05-11T03:40:50+00:00Added an answer on May 11, 2026 at 3:40 am

    What about:

    <%= tax_payment.user.name if tax_payment.user %> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is one of those things that you read once, say aha! and then
This is just one of those little things I did all the time in
Hey, so this is one of those questions that seems obvious, and I'm probably
I think this is going to be one of those simple-when-you-see-it problems, but it
This is one of those I probably should know this, but I don't questions.
This is yet one more of those how to switch from running with a
Hey this is going to be one of those dumb questions. I am trying
Good-morning one and all! This is going to end up being one of those
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>
What's the difference between these: This one works: char* pEmpty = new char; *pEmpty

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.