Rails中activeAdmin的使用
一、开始ActiveAdmin
同时,这个时候会显示相关的配置信息,并按照配置信息完成相关指示操作。
Some setup you must do manually if you haven't yet:
1. Ensure you have defined default url options in your environments files. Here
is an example of default_url_options appropriate for a development environment
in config/environments/development.rb:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
In production, :host should be set to the actual host of your application.
2. Ensure you have defined root_url to *something* in your config/routes.rb.
For example:
root :to => "home#index"
3. Ensure you have flash messages in app/views/layouts/application.html.erb.
For example:
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
4. If you are deploying Rails 3.1+ on Heroku, you may want to set:
config.assets.initialize_on_precompile = false
On config/application.rb forcing your application to not access the DB
or load models when precompiling your assets.
5. You can copy Devise views (for customization) to your app by running:
rails g devise:views
编辑config/initializers/devise.rb
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender =
"xxx@126.com"
#换成你的邮箱,最好不要是gmail
编辑config/environments/development.rb
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors =
true
#此处改为true
config.action_mailer.default_url_options = {
:host
=>
"localhost:3000"
}
#刚才devise的提示中提到这一句
config.action_mailer.delivery_method =
:smtp
config.action_mailer.smtp_settings = {
:address
=>
"smtp.126.com"
,
:port
=>
25
,
:domain
=>
"126.com"
,
:authentication
=>
:login
,
:user_name
=>
"xxx@126.com"
,
#你的邮箱
:password
=>
"xxxxxx"
#你的密码
}
5、迁移你的db ,rake db:migrate,然后运行rails server 。
1、现在将整个页面汉化一下
首先,我们已经在config/application.rb里配置了local为 zh-CN,
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = "zh-CN"
然后到http://github.com/tsechingho/rails-i18n/blob/master/rails/locale/zh-CN.yml
下载已经配置好的中文包到config/locales里,这样,rails的中文化已经做好了。
2、devise的汉化
到该Wiki去下载汉化包 devise.zh-CN.yml
https://github.com/plataformatec/devise/wiki/I18n
然后删除原来的devise.en.yml
3、解决编码问题
在你需要显示汉语的*.rb文件中 ,添加一句代码
#encoding:utf-8
Rails中activeAdmin的使用的更多相关文章
- Rails中的MIME类型
layout title date comments categories post rails的中的MIME类型 2014-09-08 21:40 true ruby Rails开发中经常使用不同的 ...
- rails 中 create, new, build, save 的用法以及误区汇总
自己很初级,初级的不能再初级,所以初次接触rails的时候,对于里面的create,new,build等方法不是很了解,用的很混乱,导致经常出现不必要的bug,很苦恼,决定,总结一下,结合网上已有资源 ...
- rails中weill_paginate的paginate方法中不能使用额外参数的解决办法
我们知道高版本中的rails中的分页功能已经放在will_paginate这个gem中,我们在控制器方法中往往需要调用其paginate方法来实现分页数据集控制,举个例子:正常的情况我们想要每页显示1 ...
- rails中accepts_nested_attributes_for应用
Model: class Blog < ActiveRecord::Base has_many :strip_rules accepts_nested_attributes_for :strip ...
- rails中params[:id]与params["id"]分析
写这个帖子的缘由是因为在页面参数传到rails的controller时用params[:]和params[""]都可以取到值: [1] pry(#<BooksControll ...
- Rails中的增删改查
1. rails中类与对象与SQL中表与行的关系 rails中提供了对象关系映射(ORM),将模型类映射至表,模型类的关联表名是类名小写后的复数形式,如类名Order,对应的表名为o ...
- rails中path、url路径解析,routes信息,form_for剖析,link_to示例,路由实例说明
原创,转载请注明http://www.cnblogs.com/juandx/p/3963023.html rails中path.url路径解析,routes信息,form_for剖析,link_to ...
- rails 中 create, new, build, save 的用法以及误区汇总 (转)
自己很初级,初级的不能再初级,所以初次接触rails的时候,对于里面的create,new,build等方法不是很了解,用的很混乱,导致经常出现不必要的bug,很苦恼,决定,总结一下,结合网上已有资源 ...
- rails中使用CarrierWave实现文件上传的功能
之前在用django写blog的时候头像上传和头像预览都是使用原生的js实现的,之前也有写了一篇blog.好了开始进入正题 rails中实现头像上传十分的方便,只要通过CarrierWave这个gem ...
随机推荐
- zabbix-server启动报错解决
启动zabbix-server有如下报错: 29171:20180714:084911.367 cannot start alert manager service: Cannot bind sock ...
- 微软发布TFS 2018!
也许你还没来得及使用TFS 2017,今天,微软已经发布了TFS 2018的第一个版本(RC1). 与之前所有的候选版本一样,这是一个正式上线(微软成称为go-live)的TFS版本.如果你计划采纳T ...
- ASP.NET MVC学习之模型验证详解
ASP.NET MVC学习之模型验证篇 2014-05-28 11:36 by y-z-f, 6722 阅读, 13 评论, 收藏, 编辑 一.学习前的一句话 在这里要先感谢那些能够点开我随笔的博友们 ...
- oracle 导出导入命令
imp YG_XSOA_NEW/kingo@20.14.12.14/XSSJZX file=d:\daochu.dmp full=y (导入) exp YG_XSOA_NEW/kingo@20 ...
- C# 使用ftp下载一个文件夹下的所有文件,包括子目录文件夹
这篇博客给大家补充一个方法,就是得到一个目录下的所有文件名称.在前端调用,大家写一个递归去遍历就可以了,我在这里就不在写了.具体ftp下载的方法在我的另一篇博客里有,需要的可以去看一下. /// &l ...
- Spring Batch学习笔记(一)
Spring Batch简介 Spring Batch提供了可重复使用的功能,用来处理大量数据.包括记录.跟踪,事务管理,作业处理统计,作业重启,跳过和资源管理. 此外还提供了更高级的技术服务和功能, ...
- Tomcat 7.x/8.x 优化
一.优化Connector http://www.aikaiyuan.com/8466.html tomcat的运行模式有3种 1)bio 默认的模式,性能非常低下,没有经过任何优化处理和支持. 2) ...
- Mac OS 10.12 - 如何关闭Rootless机制?
一,进入恢复模式(Recovery):具体操作方法参见下面这篇博客: http://www.cnblogs.com/sunylat/p/6414697.html 二,关闭Rootless机制 1,选择 ...
- 2018-2019-2 20175306实验三敏捷开发与XP实践《Java开发环境的熟悉》实验报告
2018-2019-2 20175306实验三敏捷开发与XP实践<Java开发环境的熟悉>实验报告 实验内容 XP基础 XP核心实践 相关工具 实验要求 1.没有Linux基础的同学建议先 ...
- 内置装饰器二:@property
property 装饰器的作用 property 装饰器将方法包装成属性,将私有属性公有化,此属性只能被读取.相当于实现get方法的对象 class People: def __init__(self ...