概要
ActionVeiw::Helperのlink_toでaタグを出力する
内容
ActionVeiw::Helperのlink_toでaタグを出力します。
= link_to 'label', :controller => 'controller_name', :action => 'action_name'
仕様
Bookshelfページにリンクが2つあります。
「click link」リンクを押下するとリダイレクトにより
ヘルプページに遷移します。
サンプルコード
view/bookshelf/index.html.haml
%h1 Bookshelf#index %p Find me in app/views/bookshelf/index.html.haml %hr/ =form_tag("/help/index", method: "post") do %input{:type => "text", :name => "bookname"}/ %input{:type => "submit", :name => "submit", :value => "submit"}/ = link_to 'click_link', :controller => 'bookshelf', :action => 'click_link' = link_to 'message', :controller => 'bookshelf', :action => 'message'