以下の内容はhttps://tbpgr.hatenablog.com/entry/20130727/1374946747より取得しました。


Ruby on Rails | コントローラ、アクションの名前及びパスの取得

概要

コントローラ、アクションの名前及びパスの取得

内容

コントローラ、アクションの名前及びパスを取得します。

サンプル

app/controller/hoge_controller.rb

class HogeController < ApplicationController
  skip_before_filter :authorize

  def index
    @time = Time.now_msec
    @time_format = Time.now_msec_format

    @controller_name = controller_name
    @action_name = action_name
  end
end

app/view/hoge/index.html.haml

%p 
  time =
  =@time
%p 
  time_format =
  =@time_format
%p 
  controller_name =
  =@controller_name
%p 
  action_name =
  =@action_name

画面




以上の内容はhttps://tbpgr.hatenablog.com/entry/20130727/1374946747より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14