Open source discussion website.
开源的论坛/社区网站系统,基于 Ruby China 发展而来。
Released under the MIT license:
Chinese translation of Rails Guides
Home Page: https://ruby-china.github.io/rails-guides/
Open source discussion website.
开源的论坛/社区网站系统,基于 Ruby China 发展而来。
Released under the MIT license:
文章一些链接已失效,看是否已经不再维护。
你好
不知道是我的版本和你的不一样还是一些其它原因,在删除博客评论这一句,在我这边是显示报错的,我检查过,其它功能都是正常的, <%= link_to 'Destroy Comment',[comment.article,comment],method: :delete,data: { confirm: 'Are you sure?' } %>,我使用的ruby 版本是2.2.0,rails 版本是4.2.0,编辑器是RubyMine,ubuntu环境下工作
Active Record 数据库迁移 这一章的3,4节中execute这个打错了打成了excute
在 Rails 4.2 发布记 中,「2.5 外键支持」与「2.6 外键支持」的内容完全相同,请查阅
很高兴邀请到 @AndorChen 来主导 Rails Guides 中文版的维护。历来 Rails Guides 中文版的主体翻译都是 @AndorChen 完成的,所以由他来维护再合适不过。
一个需要注意的变化是,为了控制内容质量,master 分支将设为保护分支,所有修改需要通过 PR 并由 @AndorChen Review 才能 Merge —— 包括管理员。
我相信 @AndorChen 能让 Rails Guides 中文版成为一个业界良心的翻译作品。✨
如果有任何意见建议,欢迎在 Issue 下评论。
括号里的版本信息是由 generator.rb
里的第87行决定:
@version = ENV['RAILS_VERSION'] || 'local'
环境变量配置的不对
第422行,循环的变量和使用的变量没有统一,我查了一下https://github.com/rails/rails上的内容,应该统一用invoices。
还有一个小小的建议,能不能像https://github.com/rails/rails这个一样,每个人都可以提merge request。
Invoice.pending.find_in_batches do | invoices|
pending_invoices_export.add_invoices(invoices)
end
when I run rake
cmd, I got this error, is there anyone also met this kind of issue?
$ rake -all
/home/vagrant/.rvm/rubies/ruby-1.9.3-p547/bin/ruby rails_guides.rb
Generating rails_on_rack.md as rails_on_rack.html
Generating 3_1_release_notes.md as 3_1_release_notes.html
Generating initialization.md as initialization.html
Generating action_mailer_basics.md as action_mailer_basics.html
Generating form_helpers.md as form_helpers.html
Generating generators.md as generators.html
Generating caching_with_rails.md as caching_with_rails.html
/home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.4/lib/active_support/core_ext/string/output_safety.rb:174:in `concat': incompatible character encodings: UTF-8 and ISO-8859-1 (ActionView::Template::Error)
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.4/lib/active_support/core_ext/string/output_safety.rb:174:in `concat'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/buffers.rb:12:in `<<'
from /home/vagrant/docs/rails-guides-translation-cn/guides/source/layout.html.erb:94:in `__home_vagrant_docs_rails_guides_translation_cn_guides_source_layout_html_erb___155988452_75975910'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/template.rb:145:in `block in render'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.4/lib/active_support/notifications.rb:161:in `instrument'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/template.rb:339:in `instrument'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/template.rb:143:in `render'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/renderer/template_renderer.rb:67:in `render_with_layout'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/renderer/template_renderer.rb:53:in `render_template'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/renderer/template_renderer.rb:17:in `render'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/renderer/renderer.rb:42:in `render_template'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/renderer/renderer.rb:23:in `render'
from /home/vagrant/.rvm/gems/ruby-1.9.3-p547/gems/actionview-4.1.4/lib/action_view/helpers/rendering_helper.rb:32:in `render'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/markdown.rb:163:in `render_page'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/markdown.rb:25:in `render'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/generator.rb:205:in `block in generate_guide'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/generator.rb:195:in `open'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/generator.rb:195:in `generate_guide'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/generator.rb:144:in `block in generate_guides'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/generator.rb:142:in `each'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/generator.rb:142:in `generate_guides'
from /home/vagrant/docs/rails-guides-translation-cn/guides/rails_guides/generator.rb:97:in `generate'
from rails_guides.rb:63:in `<main>'
rake aborted!
Command failed with status (1): [/home/vagrant/.rvm/rubies/ruby-1.9.3-p547/...]
/home/vagrant/docs/rails-guides-translation-cn/guides/Rakefile:80:in `block (3 levels) in <top (required)>'
/home/vagrant/docs/rails-guides-translation-cn/guides/Rakefile:129:in `block in <top (required)>'
/home/vagrant/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => guides:generate => guides:generate:html
(See full trace by running task with --trace)
articles_controller.rb中的show方法和destroy方法前须要加上public
以 getting_started.md
为例,把 source/zh-CN/getting_started.md
译文与原文 source/getting_started.md
同步。这是一项体力活,需一行一行过一遍。
https://ruby-china.github.io/rails-guides/association_basics.html#has-one-association-reference
当前使用的rails 4.2.1
按教程中在has_one中加foreign_key是不生效的,在belongs_to中加foreign_key才生效
建议就是叫 Rails缓存 或者Rails的缓存机制
From:
https://github.com/docs-china/rails/blob/master/_docs/getting_started.md
To:
source/zh-CN/getting_started.md
Convert the format to original Rails Guides format.
https://ruby-china.github.io/rails-guides/security.html
《Ruby on Rails 安全指南》"3.1 CSRF 对策"中有拼写错误:scipt 标签
Active Record 基础 2.2 模式约定 中
type - 让模型使用单表集成;
翻译错误,应该为
type - 让模型使用单表继承;
$ docker run -it -v $(pwd):/app rails-guides rake guides:generate:kindle
/usr/local/bin/ruby rails_guides.rb
Generating 3_0_release_notes.md as 3_0_release_notes.html
Generating 3_1_release_notes.md as 3_1_release_notes.html
Generating 3_2_release_notes.md as 3_2_release_notes.html
Generating 4_0_release_notes.md as 4_0_release_notes.html
Generating 4_1_release_notes.md as 4_1_release_notes.html
Generating 4_2_release_notes.md as 4_2_release_notes.html
Generating 5_0_release_notes.md as 5_0_release_notes.html
US-ASCII
/app/rails_guides/markdown/renderer.rb:34:in `paragraph': invalid byte sequence in US-ASCII (ArgumentError)
from /app/rails_guides/markdown.rb:78:in `render'
from /app/rails_guides/markdown.rb:78:in `generate_body'
from /app/rails_guides/markdown.rb:22:in `render'
from /app/rails_guides/generator.rb:163:in `block in generate_guide'
from /app/rails_guides/generator.rb:142:in `open'
from /app/rails_guides/generator.rb:142:in `generate_guide'
from /app/rails_guides/generator.rb:91:in `block in generate_guides'
from /app/rails_guides/generator.rb:89:in `each'
from /app/rails_guides/generator.rb:89:in `generate_guides'
from /app/rails_guides/generator.rb:37:in `generate'
from rails_guides.rb:20:in `<main>'
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby rails_guides.rb...]
/app/rakefile:22:in `block (3 levels) in <top (required)>'
/app/rakefile:35:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => guides:generate:html
(See full trace by running task with --trace)
不知哪一步把 body 弄成了 US-ASCII 编码,有空再查。
将“事务” 翻译成了“事物”
在 http://guides.rubyonrails.org/layouts_and_rendering.html
2.2.3 Rendering an Action's Template from Another Controller 这一节里,
“which was required on Rails 2.2 and earlier” 被翻译成了 “Rails 2.2+ 必须这么做”
应该是 "Rails 2.2- 必须这么做"?
第11节hash的扩展中第11.4.4 节
deep_symbolize_keys! 把指定散列及其中嵌套的散列的键全都转换成符号。例如:
{nil => nil, 1 => 1, "nested" => {"a" => 3, 5 => 5}}.deep_symbolize_keys
=> {nil=>nil, 1=>1, nested:{a:3, 5=>5}}
结果中的nested前面漏掉了:号
应该是
=> {nil=>nil, 1=>1, :nested:{a:3, 5=>5}}
7.4 CSS注入 中:“MySpace 禁用了很多标签,但允许使用 CSS。因此,蠕虫的作者通过下面这种方式把 JavaScript 值入 CSS 中:”
‘值入’应该是‘植入’
在第4小节"处理 Ajax 事件" 中 "ajax:success"事件的参数是[ xhr, status, err ],而在jquery-ujs的wiki中的参数是[ data, status, xhr ]。谢谢查看!
Custom events fired during "data-remote" requests
写这个方法应加上前面public,新手可能不知道哦
As title.
As you can see, our validation lets us know that our Person is not valid without a name attribute. The second Person will not be persisted to the database.
(如上所示,如果 Person 没有 name 属性,验证就会将其视为不合法对象。创建的第二个 Person 对象不会存入数据库。)
其实英文里面的意思是说Person的name属性字段不允许为空值,而不是没有属性吧。是否可以改成“如果Person的name属性没被赋值”呢?
应该是/articles
“这只是一项温和的弃用,目前代码不受影响,也不看看到提醒,但是以后会删除这个常量。”
这一句 “也不看看到提醒”,是否应该为“也不会看到提醒”。
第10部分 《接下来做什么》 的第一个链接有误
Ruby on Rails 指南
http://guides.ruby-china.org/{{ site.baseurl }}/index.html
Please repair a typesetting error on this page (http://dwz.cn/2ampPD), about “yaffle/test/acts_as_yaffle_test.rb”.
fork了一份开始翻译“Active Support 核心扩展”这段,但是进展缓慢。
按目前速度这周恐怕都难翻完,@Andor_Chen自己一人搞定了那么多,这是何等大爱呀...
当前文字:Rails 为生产环境设置的默认日志等级是 info,生产环境和测试环境的默认日志等级是 debug。
应该为:Rails 为生产环境设置的默认日志等级是 info,开发环境和测试环境的默认日志等级是 debug。
是直接把 rails/guides 下的文件同步更新过来,保留:
require "rails_guides/cn" # PLEASE DO NOT FORGET ME
然后在 source/zh-CN 里做更新以及更新 Gemfile 和 Dockerfile 中的 ruby、rails 版本吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.