我在我的博客文章的文本中添加图像。
我有 BlogImage 模型:
class BlogImage < ActiveRecord::Base
attr_accessible :blog_id, :caption, :image
belongs_to :blog
has_attached_file :image, styles: { big: "1200X630>", medium: "300x300>", thumb: "300x300>" }, default_url: "/images/:style/missing.png"
validates_attachment_presence :image
validates_attachment_size :image, :less_than => 3.megabytes
validates_attachment_content_type :image, :content_type => ['image/jpeg', 'image/png']
end
我的文章正文呈现为:
:markdown
#{blog.body}
降价由 gem 处理rdiscount
我希望能够在我的降价中写一个标签(例如[image_name]
或类似的),以便在使用正确的图像标签呈现时自动转换。
我不知道从哪里开始。
谢谢。