Rails Scaffold generated crud display custom column names

Source: Internet
Author: User
Tags i18n


1. Visit the official website of the Rails i18n plugin to view the information
Http://guides.rubyonrails.org/i18n.html
2. Add the test to Gemfile rails4.2.1 do not install this gem
Gem ' rails-i18n '
3. Install by using bundle install
4. Configure CONFIG/APPLICATION.RB
[Ruby] View plaincopy
1. # CONFIG/APPLICATION.RB
2. Config.i18n.load_path + = dir[rails.root.join (' config ', ' locales ', ' * * ', ' *.{ RB,YML} ')]
3. Config.i18n.default_locale =: ' ZH-CN '

5. Create the model's Chinese information
Add Chinese config file/config/locales/models/dps/zh_cn.yml
Where DPS is the name of model
The contents of ZH_CN.YML are as follows:
[Ruby] View plaincopy
1. ZH-CN:
2. ActiveRecord:
3. Models:
4. DPS: ' Data processing system '
5. Attributes:
6. DPS:
7. SYS_ID: ' System number '
8. Description: ' System description '
9. Pulse: ' System pulse '
Last_received: ' Last Record count '
One. Last_received_time: ' Last data Time Received '
Amount: ' Total number of records accepted '


6. Use the following statement where you want to call the display
<%= Dps.human_attribute_name:sys_id%>

Rails Scaffold generated crud display custom column names

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.