Also I am not sure what rails default is when you just add a
"?"....does it only fail if caption is nil?

I like to do something like this in these scenarios:

def the_caption
  self.caption.blank? title : caption
end

I haven't used read_attribute yet but from the docs it might look
something like this

def caption
      caption = read_attribute(:caption)
      caption.blank? self.title : caption
end

You get the idea though....just wanted to mention the "blank" part
because if your caption is somehow set to " " I am guessing you want
the title returned.

On Oct 8, 9:43 am, Marnen Laibow-Koser <rails-mailing-l...@andreas-
s.net> wrote:
> Mauricio Szabo wrote:
> > Have you tested it? I tried on a test application, and it works...
>
> Hmm.  Maybe ActiveRecord's method_missing trickery strikes again...
>
>
>
> > On Oct 8, 9:06 am, Marnen Laibow-Koser <rails-mailing-l...@andreas-
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> [email protected]
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to