我有map.resources :posts
,我希望能够以降价格式提供邮寄机构.所以我设置了我的respond_to
块:
respond_to do |format| format.markdown { render :text => @post.body.to_s } end
但是当我尝试访问时/posts/1234.markdown
,我收到此错误:
NameError (uninitialized constant Mime::MARKDOWN): app/controllers/posts_controller.rb:96:in `show' app/controllers/posts_controller.rb:79:in `show'
如何将降价添加为可接受的格式?我在哪里可以看到可接受格式的列表?
http://weblog.rubyonrails.org/2006/12/19/using-custom-mime-types
# add in config/initializers/mime_types.rb Mime::Type.register "text/markdown", :markdown