rvm 没装好,报操作系统。
vbox
发布 gem 还需要一份责任心。
class Product
# overwrite the product#name method
def name
read_attribute(:name)
end
end
奥,没留意楼主没用 ORM,那直接 2 楼行了
版本多少,我今天 update 出问题了
To do this, run bundle update, which will ignore the Gemfile.lock, and resolve all the dependencies again. Keep in mind that this process can result in a significantly different set of the 25 gems, based on the requirements of new gems that the gem authors released since the last time you ran bundle update.
我觉得我没理解错啊,update 不是升级到满足依赖的最新版的意思吗?
If you run bundle update with no parameters, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources.
http://gembundler.com/v1.3/bundle_update.html
这咋回事。
为什么楼主不想想是自己的问题?
Working with JavaScript in Rails http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html
别想了。
@test = test
原理也是全局变量。
如果不希望全局变量,其实是要好好规划自己的 js 模块。可以看看 turbolinks 的代码
https://github.com/rails/turbolinks/blob/master/lib/assets/javascripts/turbolinks.js.coffee
等中文版 epub 格式电子书。
我已经饥渴难耐啦
这么多人黑不缺我一个了 : )
看这两段类似功能的代码量的对比
https://github.com/chloerei/code_campo/blob/master/app/controllers/topics_controller.rb https://github.com/cnodejs/nodeclub/blob/master/controllers/topic.js
虽然说 cnodejs 这段没有分离 model 代码所以多了不少,但主要还是异步回调还有错误码判断耗费太多代码。
前端学 js 目前是唯一选择,即使用 coffee 也是基于对 js 的了解才能用好。后端我就不想用 js 了,什么用着舒服用什么,并发问题还有不少选择,Erlang 或 Go 对我吸引力还大点。
自动保存问题,可以再看看 Google Doc,它也是每个输入都触发保存事件。writings.io 比它差的地方是每次都全文发送,Google 每次发送量都是固定的,writings.io 随着文字增加会越发越多,累计起来每篇文章大概 1M 的总流量差异,这对桌面网络环境来说不算什么(包月流量为啥不用),移动目前放弃。另外触发的事件次数没准 Google 还要多,因为光标上下左右移动 Google 都会保存,writings.io 只有实际输入才会保存。
Google 耍了个小技巧,Saving -> Saved 的提示信息是延后几秒切换,所以用户看上去不会知道背后其实一直在频繁提交。我也打算这样弄,不过目前还在做别的东西。
回退卡应该是 Undo 机制的问题,因为还没有标准的 Undo 管理器,所以自己写了一个,又因为 Mac 和 Linux 两个平台的事件触发不一致,添加了额外的检查逻辑,所以实现得比较低效。
根据 CNZZ 的统计数据,2012 年,IE6 在中国网民中的市场份额,从年初的 25% 降到了 16%,已经低于 IE8 的 22%,IE8 这一年基本维持稳定。
http://www.pingwest.com/ie6-china/
已经真到快要可以忽略的程度了吧,除非目标用户人群就在这 16% 里面。
341
搜了一下,下一版官方 guide 应该有 Javascript 部分了
http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html
#8 楼 @ChanceDoor 首先查询过程是交给搜索引擎插件执行的,ActiveRecord 的分页插件的 :page :per_page 参数只能转换为数据库查询,所以要自己转换 :limit,:offset 这些参数输入给搜索引擎的查询。
然后搜索引擎查询会返回一个结果集,包含结果数组,和 limt、offset、total_count 之类的信息,用这些信息组装一个分页插件能理解的结果集对象。具体要看分页插件的文档或者源码。
看顶楼我就奇怪了,数组取前两个跟分页没啥关系。
这个问题是要把 solr 返回的数组拼装成分页插件能理解的集合对象。
完全脱离时代。
names.first(2).each do |n|
puts n
end