私は次のこと「ユーザーを追加」=>「ユーザーの作成」、「ユーザーの編集」=>「ユーザーの更新」などのようなカスタマイズボタンと成功メッセージ
- アクション名をカスタマイズしたい 「ユーザー作成に成功」=>「顧客が正常に作成さ」のような
- 成功メッセージでは
- を、削除の作成と編集編集の横に表示ページ上のボタンを作成し、はい、それは可能である
私は次のこと「ユーザーを追加」=>「ユーザーの作成」、「ユーザーの編集」=>「ユーザーの更新」などのようなカスタマイズボタンと成功メッセージ
を削除を追加します。
アクション=>、 "ユーザーの編集" => "更新 ユーザー" など
f.actions
を持つことの代わりに
"ユーザーの作成"、あなたは
<%= f.actions do %>
<%= f.action :submit, as: :button, label: 'Create User' %>
<%= f.action :cancel, as: :link %> # change it to button if needed
<% end %>
持つことができ、 "ユーザーの追加" のような名前
ActiveAdminはformtastic、read more hereを使用します。
def create # or any other action
super do |format| # this is important - override the original implementation
flash[:notice] = 'Your custom message for successful user creation'
# you do understand, that if you have different routes you should change this, right?
redirect_to admin_users_path
end
end
:削除で成功メッセージ、=>
def create # or any other action super do |format| # this is important - override the original implementation redirect_to( admin_users_path, notice: 'Your custom message for successful user creation' ) and return end end
ます。また、これを試みることができる "お客様正常に作成さ" "に成功 作成したユーザー" のような作成と編集
作成ボタンを追加編集と削除の横のページを表示
action_item only: :show do
link_to 'Create new user', new_admin_users_path
end
私は2番目(上からrefrence)のための答えを追加することですが、上記の検証エラーで私が働いていない、より良い
controller do
def update
super do |format|
if [email protected]_object.errors.any?
redirect_to(
admin_my_localities_path,
notice: 'custom message.'
) and return
end
end
end
def destroy
super do |format|
if [email protected]_object.errors.any?
redirect_to(
admin_my_localities_path,
notice: 'custom message.'
) and return
else
redirect_to(
admin_my_localities_path,
alert: 'custom error.'
) and return
end
end
end
end
1と2を、あなたを助けることができるそれをカスタマイズするので、動作していません。.. .... 最初に、リンクとして表示をキャンセルします 2番目に、何も起こらない – Mukesh
私は答えを編集しました。第1回 - 私が示唆したようにドキュメントを読み、[あなたにリンクを与えました](https://github.com/justinfrench/formtastic# - 物語)。 2それは動作するはずです、あなたは 'controller do end'ブロックの中でそれを定義しましたか? –
ありがとうたくさんのおい...今すぐ全部働いて...... :) – Mukesh