一、开始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/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
,
: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