Reputation: 18649
I have a variabla var. If I try to output its value in HAML like =val then I just get the string value of the object which looks like this: #<ShortenedUrl:0x118c50fa
.
But how do I get the value that is in there?
Upvotes: 6
Views: 22527
Reputation: 11647
I think you may want the .inspect
method.
= val.inspect
That will show you something like:
#<ShortenedURL @url="the url", @count=0, @etc="etc">
Of course, if you want to dive in to specifics (for example, you only want to show someone the url
attribute (or whatever attribute you may have), then use that method:
= val.url
Which will show:
the url
Upvotes: 11