# Simple string comparasons

**URL:** <https://www.ruby-forum.com/t/simple-string-comparasons/180672>\
**Category:** Rails\
**Created:** [December 25, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/simple-string-comparasons/180672 "2009-12-25T17:08:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [December 25, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/simple-string-comparasons/180672/1 "2009-12-25T17:08:58Z")

</div>

Hey Everyone I’m caught up on some data output.

this is what i currently have:

Make:\<%=h vehicle.make %\>Model:\<%=h vehicle.model %\>Year:\<%=h vehicle.year %\>Mileage:\<%=h vehicle.mileage %\>

```
<% if vehicle.vehicle_options.drive.eql? "please_select" %>
  <dt>Transmission:</dt><dd><%=h 

```

vehicle.vehicle\_options.transmission  
%\>  
\<% end %\>

```
<% if vehicle.exterior_color.eql? "not_specified" %>
  <dt>Ext Color:</dt><dd><%=h vehicle.exterior_color %></dd>
<% end %>
<% if vehicle.vehicle_options.drive.eql? "please_select" %>
  <dt>Drivetrain:</dt><dd><%=h vehicle.vehicle_options.drive %></dd>
<% end %>
<% if vehicle.vehicle_options.engine_size.eql? "" %>
  <dt>Engine:</dt><dd><%=h vehicle.vehicle_options.engine_size %></

```

dd\>  
\<% end %\>

Price:\<%=h vehicle.price %\>

I have some enumerated fields on creation and I don’t want to display  
them in the event someone has decided not to fill them out (ie leaving  
them as the default). The above does not work sadly. How can I  
appropriatly check for this. I also have some boolean values as well  
as possible nils(Or blank space). How can I check for these and if  
theres content display it. Otherwise skip that whole field ?

I figure it should be pretty easy but everything I try fails.

Thanks, Happy Holidays !  
brianp

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [December 25, 2009, 5:53pm UTC](https://www.ruby-forum.com/t/simple-string-comparasons/180672/2 "2009-12-25T17:53:11Z")

</div>

brianp wrote:

> I have some enumerated fields on creation and I don’t want to display  
> them in the event someone has decided not to fill them out (ie leaving  
> them as the default). The above does not work sadly. How can I  
> appropriatly check for this. I also have some boolean values as well  
> as possible nils(Or blank space). How can I check for these and if  
> theres content display it. Otherwise skip that whole field ?
> 
> I figure it should be pretty easy but everything I try fails.

object.blank?

[http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M000098&name=blank](http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M000098&name=blank)?
