Hi!! I have a few models that use a Photo polymorphic model. It's all good and fine for saving or accessing the photos' attributes via console or inspect or logger, but if I try to call them directly in the view with, for example, @banner.photo.file, it returns a undefined method 'file' etc for nil:Nil
Photos are being uploaded via paperclip and all models are set with has_one :photo, :as => :imageable and accepts_nested_attributes_for :photo, :allow_destroy => true. And the Photo model is set as belongs_to :imageable, :polymorphic => true and has_attached_file :file. These are the columns for the Photo model: id:integer file:string imageable_id:integer imageable_type:string file_file_name:string file_content_type:string file_file_size:integer (besides created_at etc) In my view: <% @banners.each do |b| %> <%= b.photo.inspect %><br /> <% end %> You can see the inspect at http://bdyvu2.hospedagemweb.net/ Many thanks in advance!! Going out of my mind here!! (been at it for days!) -- 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-talk@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.