How I can check if an object is null in ruby on rails 2?
ruby, ruby-on-rails, ruby-on-rails-2
Solution
it's `nil`in Ruby, not `null`. And it's enough to say `if @objectname` to test whether it's not nil. And no `then`. You can find more on `if` syntax here:
http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Control_Structures#if
Problem
I want to check when my object `@objectname` is not equal to null to show the values of the `@objectname` else to show that no values found. I tried this: ``` <% if (@objectname != null) then %> ``` but I'm getting an error.