この小さな問題を解決しようとして、ようやくポリモーフィックな関連付けが機能するようになりましたが、レコードが保存されたらビューに画像を表示する方法がわかりません。
私のセットアップ
class Image < ActiveRecord::Base
belongs_to :imageable, polymorphic: true
attr_accessible :photo
has_attached_file :photo, :styles => { :small_blog => "250x250#", :large_blog => "680x224#", :thumb => "95x95#" }
end
class Post < ActiveRecord::Base
has_many :images, as: :imageable
accepts_nested_attributes_for :images
attr_accessible :comments, :title, :images_attributes
end
したがって、私の見解では、現時点ではこれがあり、未定義のメソッド「写真」エラーがスローされています
<% @posts.each do |p| %>
<%= image_tag(p.photo.url(:large_blog), :class => 'image') %>
<% end %>
任意のポインタをいただければ幸いです