Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

MIME Types support #147

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

MIME Types support #147

botanicus opened this issue Jan 18, 2010 · 2 comments

Comments

@botanicus
Copy link
Owner

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant