我有带图片和视频的模型
如何检查enclosure_type
然后保存在正确的位置?
feed_entry.rb
class FeedEntry
include Mongoid::Document
field :enclosure_url, type: String
field :enclosure_type, type: String
field :video, type: String
mount_uploader :picture, PictureUploader
end
例如:
feed = Feedjira::Feed.fetch_and_parse 'http://example.com/feed.xml'
feed.entries.first.enclosure_url # => "http://example.com/d260eb5c"
feed.entries.first.enclosure_type # => "image/jpeg"
feed.entries.last.enclosure_url # => 'https://youtu.be/AnXR-MKhg64'
feed.entries.last.enclosure_type # => "video/x-ms-asf"