active admin常用配置
ActiveAdmin.register Post do
permit_params :title, :content, :deadline, :status
menu parent: "论坛管理", label: "帖子管理", :priority => 2
config.per_page = 20
config.sort_order = "id_asc"
index :title=>"帖子管理" do
selectable_column
id_column
column "标题", :title
column "提交日期" do |f|
f.deadline ? f.deadline.strftime('%Y-%m-%d %H:%M:%S') : ""
end
column "用户" do |f|
link_to f.user.id, admin_user_path(f.user) if f.user
end
column "分类" do |f|
f.label ? f.label.name : ""
end
column "创建时间", :sortable=>:created_at do |f|
f.created_at.strftime('%Y-%m-%d %H:%M:%S')
end
actions
end
form do |f|
f.inputs "Post详情" do
f.input :title, :label => "标题"
end
f.inputs "额外信息" do
f.input :content, :label => "标题"
end
f.actions
end
show :title=>:title do
attributes_table do
row "操作" do
link_to("设置置顶", set_stick_admin_post_path(post.id)) + " " + link_to("取消置顶", clear_stick_admin_post_path(post.id))
end
end
end
#route当中无需任何配置
member_action :set_stick do
post = Post.find(params[:id])
post.update_attribute :status, Setting.posts.status_stick
redirect_to admin_post_path(params[:id])
end
member_action :clear_stick do
post = Post.find(params[:id])
post.update_attribute :status, Setting.posts.status_none
redirect_to admin_post_path(params[:id])
end
controller do
def update
update! do |f|
puts permitted_params[:citrine][:count]
f.html {redirect_to root_path}
end
end
end
end
active admin常用配置的更多相关文章
- Vue-Router路由 Vue-CLI脚手架和模块化开发 之 路由常用配置与路由嵌套
vue-router路由常用配置 1.mode:配置路由模式,默认为hash,由于URL很丑,可以修改为history,但是需要服务端的支持: 以上一篇的博文为实例: 初始时url的显示: 使用mod ...
- 最全的Django入门及常用配置
Django 常用配置 Django 安装 pipx install django x 为python解释器版本2 or 3 如果你想安装指定版本的django,使用pip install djang ...
- Pycharm常用配置
Pycharm常用配置 pycharm中的设置是可以导入和导出的,file>export settings 可以保存当前pycharm中的设置为jar文件,重装时可以直接import setti ...
- 【第六课】Nginx常用配置下详解
目录 Nginx常用配置下详解 1.Nginx虚拟主机 2.部署wordpress开源博客 3.部署discuz开源论坛 4.域名重定向 5.Nginx用户认证 6.Nginx访问日志配置 7.Ngi ...
- Apache入门 篇(二)之apache 2.2.x常用配置解析
一.httpd 2.2.x目录结构 Cnetos 6.10 YUM安装httpd 2.2.x # yum install -y httpd 程序环境 主配置文件: /etc/httpd/conf/ht ...
- resin的几个常用配置
参考原文:http://blog.csdn.net/johnson1492/article/details/7913827 本文着重介绍resin的几个常用配置 注: 1. 本文并非resin.con ...
- Spring Boot常用配置
概述 本文主要写了下Spring Boot的一些常用配置. Spring Boot基本配置 入口类: Spring Boot通常有一个名为*Application的入口类,入口类里面有一个main方法 ...
- SSH(struts+spring+hibernate)常用配置整理
SSH(struts+spring+hibernate)常用配置整理 web.xml配置 <?xml version="1.0" encoding="UTF-8&q ...
- django->基本操作和新建项目常用配置
一.安装django pip install django==2.1.5 -U #安装django/升级最新版本 二.创建.启动django项目 django-admin startproject m ...
随机推荐
- day7_直播_网络编程篇(元昊老师著)
网络编程篇计算机网络: 多台独立的计算机用网络通信设备连接起来的网络.实现资源共享和数据传递. 比如,我们之前的学过的知识可以将D盘的一个文件传到C盘,但如果你想从你的电脑传一个文件到我的电脑上目前是 ...
- jdbc批处理
批量处理允许将相关的SQL语句分组到批处理中,并通过对数据库的一次调用来提交它们,一次执行完成与数据库之间的交互. 一次向数据库发送多个SQL语句时,可以减少通信开销,从而提高性能. 不需要JDBC驱 ...
- 【Node.js】Mac 下安装node图文详解
1 进入官网,下载node最新版 官网:https://nodejs.org/en/ 2 双击下载的安装包,一路默认安装就行 3 打开终端,输入以下命令查看结果,如出现下图信息则为安装成功 4 ...
- 重装Delphi10.2的IDE必要设置
重装Delphi10.2的IDE必要设置: 1,Tools->Options Editor Options->Display 右侧的 Right margin: 设为200 这个设置是为右 ...
- 微信Tinker的一切都在这里,包括源码(一)
版权声明:本文由张绍文原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/101 来源:腾云阁 https://www.qclo ...
- 关于font-size对垂直居中影响的问题
背景:三个inline-block元素,其中两个内容为空,另外一个包含文字,设置文字的font-size之后,原本垂直居中的三个inline-block的元素,会变的不再垂直居中. 原因: 当设置了f ...
- CentOS下PostgreSQL的安装与配置
一.CentOS下PostgreSQL的yum安装: #安装yum源,默认源存在对版本的支持不好,下载不到等等问题. yum install http://yum.postgresql.org/9.5 ...
- mysql 安装流程 兼容8.0.0以上版本 解决修改密码规则问题
背景介绍: 第一次安装mysql服务端,版本8.0.6 遇到了问题:1:不知道流程:2:8.0以上版本密码加密规则修改的解决方案: 1:下载mysql 服务端 https://dev.mysql. ...
- Egret打包App 短暂黑屏解决方案 (Egret4.1.0)
论坛已经有人解决:http://bbs.egret.com/forum.php?mod=viewthread&tid=30288&highlight=app%2B%E9%BB%91%E ...
- 【Enterprise Architect 】
[Enterprise Architect ]Enterprise Architect 8 key {67SC0O95-SZPS-LIG2-YQ8Q-8D2N-KWTD-0W6R-TWDD-KT6RB ...