Skip to content

Instantly share code, notes, and snippets.

@igrep
Created February 24, 2013 13:17
Show Gist options
  • Select an option

  • Save igrep/5023809 to your computer and use it in GitHub Desktop.

Select an option

Save igrep/5023809 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# GistID: 5023809
# Tried by: Rails 3.2.12
# 控えめで (Unobtrusive) 自己中な (Selfish) Controller
class UnobtrusiveJikochusController < ApplicationController
def index
@unobtrusive_jikochus = UnobtrusiveJikochu.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @unobtrusive_jikochus }
end
#=> NoMethodError in UnobtrusiveJikochusController#index
#=> undefined method `content_mime_type' for nil:NilClass
end
def request # 自己中な (selfish) request
# 自己中なことにrequestを上書きしてしまう。
# It's as selfish as overriding the request method.
# でも控えめなので何もrenderしない。
# but it's so unobtrusive that doesn't render anything.
# 結果、NoMethodErrorとなる。
# As a result, it causes NoMethodError.
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment