Skip to content

Instantly share code, notes, and snippets.

@Nursultan91
Created June 13, 2017 08:18
Show Gist options
  • Save Nursultan91/f82732a231787d8fe78a4602c0336466 to your computer and use it in GitHub Desktop.
Save Nursultan91/f82732a231787d8fe78a4602c0336466 to your computer and use it in GitHub Desktop.
Описание файла путь к которому app/admin/user.rb (глянь в реппозитории, я тебя в коллабораторы добавлял)
ActiveAdmin.register User do
permit_params :email, :name, :paid, :user_id, :first_ip, :current_sign_in_ip, :password
member_action :reset_ip, method: :put do
resource.first_ip = resource.current_sign_in_ip
resource.save!
redirect_to resource_path, notice: "IP сброшен!"
end
action_item :reset_ip, only: :show do
link_to 'Сбросить IP', reset_ip_admin_user_path(user), method: :put
end
show do |t|
attributes_table do
row :email, label: "Почта"
row :name, label: "Имя"
row :paid, label: "Статус оплаты"
row :first_ip, label: "IP Адрес доступа"
row :current_sign_in_ip, label: "IP Адрес доступа"
row :telephone, label: "Телефон"
row :password, label: "Пароль"
end
end
form :html => { :enctype => "multipart/form-data" } do |f|
f.inputs do
f.input :email, label: "Почта"
f.input :name, label: "Имя"
f.input :paid, label: "Статус оплаты"
f.input :first_ip, label: "IP Адрес доступа"
f.input :telephone, label: "Телефон"
f.input :password, label: "Пароль"
end
f.actions
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment