In my Ruby on Rails app, I am trying to run a query to populate a drop- down select box. The query may return NULL values, in which case I want to display a value like 'N/A'. My query works directly in MySql: select distinct(coalesce(time, "N/A")) from mytable;
But when I run this in the app using mytable.find(), the null value is returned as a 0. The database column is an integer. Is Ruby somehow changing my desired value to 0 because it's an integer?? Again, I get the desired results in MySql. In Ruby on Rails, how can I replace the NULL value with some text value that will make more sense to the user? --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

