我是早期付费读者,下面是我发给作者的勘误,她可能没时间处理,如果谁有空给她发 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
#34 楼 @xiongxin8802 一个人用无所谓,如果你希望以后还有人跟你合作,最好用些烂大街的框架。
Xamarin 最大的好处就是可以多个 Windows Phone 平台,虽然微软手机用户不多,但也还是有一点用户的,如果你推出这个平台客户端,那至少会多一些竞争力。
缺点也很明显,C#几乎和“开源”划等号,再强的混淆加密,很容易就可还原成原代码。 另外用 Xamarin 跨平台,至少要知道原生应用怎么写,熟悉框架,如果是小应用,还不如用原生开发。
谢谢各位,我研究一下
#4 楼 @blacktulip 你不是还研究了一段 js 吗,现在应该是你用 js 一桶姜山 的时候了
迅雷下载 http://dl.google.com/vgsa/vgsa_20090210.7z
然后 google "vgsa_20090210"
感觉如何?用 Swift 是不是没有原来那种真气逆行的感觉了?
这么多米农
swift-dev.com swift-dev.net swift-dev.org swift-dev.info
昨天全被拿下,org 的应该是个中国人,用的 dnspod
nice!
#7 楼 @michael_roshen 我估计你找的是那个做视频的 @happypeter
我觉得还是自己创业好了,前期来说 CRUD 够用了,不会遇到这些变态的需求。等项目做起来,有性能问题了,再收集这些变态的题目招点人,呵呵
写玩具用 heroku 很方便啊
不过大项目就要流血了,太贵了
#6 楼 @gonglexin Cancancan 还算折腾明白了,会用能用,不想再折腾 Pundit 了
想问一下,相对 Cancancan,Pundit 能很精细的控制各个权限吗?比如各种 role,每个 role 有不同权限
那如何在 view 中实现 cancan 那种功能:
<% if can? :update, Article %>
<%= link_to "Edit", edit_article_path(@article) %>
<% end %>
<% if can? :update, Comment %>
<%= link_to "Edit", edit_comment_path(@comment) %>
<% end %>
你可以让用户点击过去后提示说没有权限,但如果能在 view 中隐藏没有权限的链接那才是最完美的
不知道楼主想做什么,是不是这个问题? How can i use multiple controller with one model? http://stackoverflow.com/questions/11929693/how-can-i-use-multiple-controller-with-one-model
主从 +1
我做了读写分离,主服务器写,三台从服务器读,某台从服务器凌晨备份,这还要出问题,估计是因为地球偏离轨道了。
我刷站有肌肉记忆了,直接在 chrome 打 r 回车 工作时间刷一下能有效缓解疲劳
楼主估计累坏了,睡觉去了,也不来回帖
#2 楼 @blacktulip 大家都说是两个女儿,你来确定一下
这类应用就是一阵风,吹不长久的, 从 kaixin001, renren, facebook,再到微博微信,大家移情别恋的成本相当低,两天就玩腻了 现在连 facebook 都还面临活跃度的问题
codeclimate 太贵了吧
#23 楼 @hlxwell #22 楼 @SharpX 3 比 7 的比例,个人喜欢第二种,也就是 jave 风格,省一行,更紧凑,从结尾向上就能找到哪个 if http://bit.ly/1h7NZz0
#4 楼 @waitingaminute 好名字啊,劳动人民的智慧啊,这就效果就是像吐舌头
#2 楼 @xiongxin8802 N 年前不收费的时候申请的企业邮箱,不要钱