分享 Rails 101 now free

xdite · 2014年06月03日 · 最后由 runup 回复于 2014年06月10日 · 6395 次阅读

http://blog.xdite.net/posts/2014/06/03/rails-101-now-free

簡單來說,現在不用錢了。

初学者的福音

9 楼 已删除

之前买书的人不哭死。。

弱弱問一句,付錢買書會覺得很冤枉嗎?

@xdite 希望您的博客能有 weibo 的分享功能 您的文章 我们能及时的分享在微博

好。晚點做

#11 楼 @xdite 好书的价值在于把复杂的事情简化,但这样的书不多。

我最近看到一本讲 git 的书,感觉收获很大,就捐了钱。作者制作了 iphone 版本是收费的,我觉得这个模式好。 先读后付钱。

这是更好的推广 rails,谢谢分享。

中文世界唯一一本 Rails 4.0.0 + Ruby 2.0.0 的自學書籍

付费买过的过来点赞!

好伟大,好慷慨……

23 楼 已删除

花钱买书不冤枉呀,不过我会告诉你我一开始就是免费看的吗?之前我支付不了,xdite 直接给我免掉了,再次感谢。

thank xdite 👍

我是花钱买的,感觉很不错呀。而且后来还更新过,更新版本可以免费获取

我已经下载了

#15 楼 @chenge 能推荐一下您提到的 git 的书么?

赞!感谢!

我是早期付费读者,下面是我发给作者的勘误,她可能没时间处理,如果谁有空给她发 pull-request 吧。

Ch 2.1.4 建立 Posts Controller 裡的 edit 在 app/controllers/groups_controller.rb 加入 edit 這個 action

这里应该是 app/controllers/posts_controller.rb

————————————————————————

Ch 2.1.5 建立 Posts Controller 裡的 update 在 app/controllers/postss_controller.rb 加入 update 這個

这里 postss_controller.rb 多了个 s

———————————————————————— 練習作業 3 - 為 Group 與 Post 加入使用者機制 搜索: Descroption 替换为: Description

最后面 if 后面的“)”的位置不对: <%= link_to("New Post", new_group_post_path(@group) , :class => "btn btn-mini btn-primary" if current_user )%> 替换为: <%= link_to("New Post", new_group_post_path(@group) , :class => "btn btn-mini btn-primary") if current_user %>

———————————————————————— 練習作業 4 - User 可以加入、退出社團

在 Group model 加入 has_many :group_users has_many :members, :through => :group_users, :source => :group

这里最后应该是 :source => :user

———————————————————————— 練習作業 5 - 實作簡單的 Account 後台機制 搜索: Descroption 替换为: Description

搜索: 修改 app/common/_user_nav.html.erb 裡的 替换为: 修改 app/views/common/_user_nav.html.erb 裡的

———————————————————————— 練習作業 6 - Refactor code

搜索: lenth 替换为: length ———————— 另外这个 helper 欠妥: def render_post_content(post) auto_link(truncate(simple_format(@post.content), :lenth => 100)) end

因为 simple_format 会生成 html code,但 truncate 会破坏结尾的 html code,导致不能正常显示。 另外 auto_link 在 rails 3.1 之后不能用了,建议去掉 auto_link,不影响例子。

如果这个 helpler 用在 views/groups/show.html.erb 中 最好是传 post.content,而不是 @post <% @posts.each do |post| %>

<%= render_post_content(post.content) %>

...

修改后: def render_post_content(content) simple_format(truncate(content, :length => 100)) end ———————— 另外, Ch 6.2 下面写的是:

更多的 Partial 用法 http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials

文字是不是要改成:“更多的 Helper 用法” 链接是不是要指向 helper 去?

———————————————————————— Ch 6.3 下面写的是:

Helper 是一些使用在 Rails 的 View 當中,用 Ruby 產生/整理 HTML code 的一些小方法。通常被放在 app/helpers 下。預設的 Helper 名字是對應 Controller 的,產生一個 Controller 時,通常會產生一個同名的 Helper。如 PostsController 與 PostsHelper。

是不是要换成 Partial 的介绍?

———————————————————————— 練習作業 8 - 將專案 deploy 到租來的 VPS

Ch 8.1 佈署 Rails Production 所需要的環境 这个链接要更新一下: https://github.com/rocodev/guides/wiki/setup-production-development

需要 登录 后方可回复, 如果你还没有账号请 注册新账号