[TOC]
常用Gem列表
Rails Auth
devise 验证
cancancan 权限控制
Rails Frontend
- kaminari 分页控件
1 | @users = User.all.page(1).per_page(25) |
- SimpleForm 表单
1 | 需要执行rails generate simple_form:install --bootstrap |
- Popupload 图片上传
- carrierwave-upyun 图片上传
- mini_magick
- carrierwave
- carrierwave-meta
- rest-client
- mime-types
- uuidtools
Rails Test Drive
- ffaker 快速生成测试数据
Rails Helper
- settingslogic
- magic_encoding
- local_time
1 | <%= local_time(comment.created_at) %> |
- rails-i18n
- rails_kindeditor
Ruby General
CSS中引用assets中的图片
- 首先必须是scss或sass
- image-url(source) –> assets/images/sources
Rails中格式化时间
- Add gem ‘local_time’ to your Gemfile.
- Run bundle install.
- Add //= require local_time to your JavaScript manifest file (usually found at app/assets/javascripts/application.js).
1 | <%= h local_time(notice.created_at, '%Y-%M-%d') %> |
使用Kindeditor
1、Gem ‘rails_kindeditor’
2、参考 rails_kindeditor