坐等 node.js 脚本,我直接放到 lauchagent 就好。
因为 ruby 没办法加快在 windows 上的速度,不懂为啥一个缺点怎么会变成吹唬的优点了。
看起来木啥问题,但第一个参数可以用类名吗,不是用小写那种?
belongs_to :comm_event, :foreign_key => "event_id"
当 class 中或多个 class 中有重复代码需要抽象出来时,你会想要一个 module 的东东。 因为不能多重继承,只好用 module 来补偿一下。
另一点我觉得更容易解耦,继承哪个类,你只能选一个,但具体要 include 哪几个 module 你可以根据不同需求选择不同的 module. 有了 autoload 更加能优化性能。
总的一点来说,顺其自然,你当前用什么能达到目的就用啥,过几个月或几个星期,觉得以前的写法不爽时你会自己回来重构的。
呵呵,你可以看 params[:task] 是一个什么东东,puts params[:task].inspect 一下,他应该是个 hash,包含了 name 这个 key
#12 楼 @jjym 你是什么版 本啊,我这是 delegate 到 scoped, scoped 再对应到 relation 中。
delegate :find, :first, :first!, :last, :last!, :all, :exists?, :any?, :many?, :to => :scoped
delegate :first_or_create, :first_or_create!, :first_or_initialize, :to => :scoped
delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, :to => :scoped
delegate :find_each, :find_in_batches, :to => :scoped
delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins,
:where, :preload, :eager_load, :includes, :from, :lock, :readonly,
:having, :create_with, :uniq, :to => :scoped
# File activerecord/lib/active_record/scoping/named.rb, line 30
def scoped(options = nil)
if options
scoped.apply_finder_options(options)
else
if current_scope
current_scope.clone
else
scope = relation.clone
scope.default_scoped = true
scope
end
end
end
如果 Ruby 真的火起来了,说不好哪天 windows 就会像对 node.js 一样。
关于迁移这个,有本书写得特别好,中文叫什么 rails 项目实战之类的,虽然用的是 rails 1.2,但我觉得作者的理念一点也不过时,作者本身是一名 dba,里面有个项目应该是真实案例,用来迁移旧的 php 系统,涉及到大量的旧数据库迁移知识。
我不是很喜欢,但系统提供了,就用用呗。
你自己蛋疼啊。上 heroku 用什么 taobao 源。我刚好上传,用得好好的。
practice$ git push heroku master
Counting objects: 43, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (24/24), done.
Writing objects: 100% (25/25), 2.44 KiB, done.
Total 25 (delta 19), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.rc.2
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Using rake (0.9.2.2)
不要以 windows 的思想去用 unix 系统,你管他用几 g,剩几 m, 安心做你的事就是了,系统用着顺畅就好了。你内存留着干嘛,让系统自己去调控就是了,他爱释放就释放,缓存就缓存。 都被 360 给搞蒙了
#2 楼 @diudiutang osx-gcc-installer 是什么,我从来没用过。 装好 xcode 后,装个 command line tool 就好了。
你是做.net 的,就用.net 搞。以最快的速度做出你那个对你以后影响很大的项目,发财了再回过来随便玩玩吧。
无语。
#29 楼 @willmouse ok. you win
把 gem 'spork'换成 gem 'spork-rails'
上 pcbeta 看看,有没有完美黑苹果的 thinkpad 笔记本,想用 win 用 win,想用苹果用苹果,两全其美。 不做 iphone 开发,买 mac 干球。
rake assets:clean
rvm 建 gemset
底下的错误信息已经写得非常清楚了, using RVM are available at rvm.io/packages/openssl
#3 楼 @kaitokid1224 https://github.com/plataformatec/simple_form/ 你看看这里关于 i18n 的说明能看懂不。 看不懂的话,哥给你弄个 demo 吧。
很简单。搞个全局变量做判断就好了。
#23 楼 @RainySummer 我的推荐是,你搞个 putty,然后在里面 debug 吧。
你看看是不是环境有问题哦,在里面把当前的 env 给打出来。bundle 不一定在当前 path 下有。
osx-gcc 有 apple 的 llvm 好吗。
如果单纯是使用而已,用 php 的吧,一大堆优秀的博客,在 sae 点击几下就好了 如果想通过源码学习,另当别论。