On Jan 8, 5:32 am, skt <stibre...@gmail.com> wrote:
> --------------------------------------------
> module Paperclip
>     module Interpolations
>         def post_date attachment, style_name
>             attachment.<access the post class/model
> here>.instance_read(:post_date).to_s
>         end
>     end
> end
> -------------------------------------------------
>
> Problem: The problem I am running into is that I can't seem to access
> the post model object from the definition of post_date function above
> - the attachment I understand refers to the Comment object. I have
> tried attachment.post.instance_read(:post_date) but that doesn't work.
>
isn't attachment.instance what gives you the associated AR object (ie
attachment.instance.post would be what you are looking for here) ?

Fred

> Looking for thoughts/help on how to access a field in another model in
> this situation?
>
> Thanks for any pointers - I am on 2.3.8.
>
> -S

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to