1

formtastic 送信ボタンをボタンではなくリンクとしてスタイルしようとしています。

<%= f.actions do %>
  <%= f.action :submit, :label => "Sign in", :as => :link %>
<% end %>

そして、上記は「Formtastic::UnsupportedMethodForAction」エラーを出します。

rdoc.info/github/justinfrench/formtastic#The_Available_Inputsから次のサンプル コードを見つけました。

<%= f.actions do %>
  <%= f.action :submit, :as => :button %>
  <%= f.action :cancel, :as => :link %>
<% end %>

上記のコードは、次のように変更しても失敗します

<%= f.action :submit, :as => :link %>

:as => :link は :submit でサポートされていませんか?

前もって感謝します!

4

2 に答える 2

3

生成します<input type="button" value="Sign in">

アクションに応答するリンクが必要な場合は、link_to "Profile", :controller => "profiles", :action => "create", :id => @profile, :method => :post

于 2012-07-23T06:02:15.207 に答える
2

CSS を使用してこれを行う必要があります。次のようなものを試してください

#submit-button-selector {
  background: none;
  border: none;
  color: blue;
  text-decoration: underline;
  display: inline;
}
于 2012-07-23T09:18:11.990 に答える