MIME Types support #147

Open
botanicus opened this Issue Jan 18, 2010 · 2 comments

Comments

Projects
None yet
1 participant
@botanicus
Owner

botanicus commented Jan 18, 2010

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment