botanicus / rango

Rango is ultralightweight, ultracustomizable, ultracool web framework inspired by Django.
http://101ideas.cz
MIT License
221 stars 9 forks source link

MIME Types support #147

Open botanicus opened 14 years ago

botanicus commented 14 years ago
class Application < Rango::Controller
  format(:json) do |object|
    object.to_json
  end
end

class Post < Application
  def show(id)
    if format.html?
      render "post.html", post: post
    else
      display post
    end
  end
end
class Application < Rango::Controller
  format(:json) do |object|
    object.to_json
  end

  format(:html) do |object|
    path = self.template_path(request.action)
    render path
  end
end

class Post < Application
  def show(id)
    display post
  end
end
botanicus commented 14 years ago

http://merbunity.com/tutorials/9 http://merbunity.com/tutorials/20 http://hassox.blogspot.com/2007/10/adding-mime-types-to-merb.html http://api.rubyonrails.org/classes/Mime/Type.html

botanicus commented 14 years ago

http://www.engineyard.com/blog/2010/rails-and-merb-merge-plugin-api-part-3-of-6/