这个很方便,把本来在 model 层的东西拨出来了。 取值装饰了,不知道赋值可以不可以装饰的?
#8 楼 @darkbaby123 Backbone or AngularJS?
#1 楼 @huacnlee http://open.weixin.qq.com/document/?lang=zh_CN 是不是有开放了朋友圈的 api 了?
#8 楼 @NonTwitter 重要想找些开源的东西写写。^_^ #7 楼 @hsming Railscasts 的看过。谢谢。
ffmpeg -i xxx.mp4 xxx.webm
也无法导出 webm。。。
#1 楼 @southwolf #2 楼 @guyanbiao ffmpeg 用法貌似很复杂,都需要命令的,好强大。
irb(main):013:0> Fitting.all[0].stock.amount
Fitting Load (3.1ms) SELECT `fittings`.* FROM `fittings` ORDER BY id desc
Stock Load (0.3ms) SELECT `stocks`.* FROM `stocks` WHERE `stocks`.`fitting_id` = 1753 ORDER BY id desc LIMIT 1
=> #<BigDecimal:cdc1f84,'0.1E1',9(18)>
使用:
irb(main):017:0> Fitting.includes(:stock).where("stock.amount != ?", 0)
SQL (1.4ms) SELECT `fittings`.`id` AS t0_r0, `fittings`.`name` AS t0_r1, `fittings`.`price` AS t0_r2, `fittings`.`created_at` AS t0_r3, `fittings`.`updated_at` AS t0_r4, `fittings`.`selling_price` AS t0_r5, `fittings`.`barcode` AS t0_r6, `fittings`.`unit` AS t0_r7, `fittings`.`genre` AS t0_r8, `fittings`.`store_house_id` AS t0_r9, `fittings`.`shipping_space_id` AS t0_r10, `stocks`.`id` AS t1_r0, `stocks`.`amount` AS t1_r1, `stocks`.`fitting_id` AS t1_r2, `stocks`.`created_at` AS t1_r3, `stocks`.`updated_at` AS t1_r4, `stocks`.`alarm` AS t1_r5 FROM `fittings` LEFT OUTER JOIN `stocks` ON `stocks`.`fitting_id` = `fittings`.`id` WHERE (stock.amount != 0) ORDER BY id desc
ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'stock.amount' in 'where clause
irb(main):018:0> Fitting.includes(:stock).where("amount != ?", 0)
Fitting Load (0.8ms) SELECT `fittings`.* FROM `fittings` WHERE (amount != 0) ORDER BY id desc
ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'amount' in 'where clause': SELECT `fittings`.* FROM `fittings` WHERE (amount != 0) ORDER BY id desc
上面都是不成功的。唯独下面的成功了,使用 joins 反而可以了。。
irb(main):019:0> Fitting.joins(:stock).where("amount != ?", 0)
不清除是什么个状况。
deploy@39:~$ gem install rubygems-update
Successfully installed rubygems-update-2.0.0
Parsing documentation for rubygems-update-2.0.0
Done installing documentation for rubygems-update (0 sec).
1 gem installed
deploy@39:~$ update_rubygems
RubyGems 2.0.0 installed
Parsing documentation for rubygems-2.0.0
Installing ri documentation for rubygems-2.0.0
------------------------------------------------------------------------------
RubyGems installed the following executables:
/home/deploy/.rvm/rubies/ruby-2.0.0-p0/bin/gem
Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for ruby libraries. You may access it like this:
ri Classname
ri Classname.class_method
ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.
#56 楼 @ray 我解决你那个问题了,但是还有这样的问题。
deploy@39:~$ gem -v
2.0.0
deploy@39:~$ gem install lazy_high_charts -v '1.3.3'
ERROR: Error installing lazy_high_charts:
lazy_high_charts requires RubyGems version ~> 1.3. Try 'gem update --system' to update RubyGems itself.
deploy@39:~$ gem update --system
Latest version currently installed. Aborting.
解决方法,升级 RubyGems。 http://rubygems.org/pages/download
$ gem install rubygems-update # again, might need to be admin/root
$ update_rubygems # ... here too
Installing lazy_high_charts (1.3.3)
Gem::InstallError: lazy_high_charts requires RubyGems version ~> 1.3. Try 'gem update --system' to update RubyGems itself.
An error occurred while installing lazy_high_charts (1.3.3), and Bundler cannot continue.
Make sure that `gem install lazy_high_charts -v '1.3.3'` succeeds before bundling.
请问我升级 ruby 为 2.0 后,bundle install 就出现这个问题了。运行 update 后还是得不到解决。
Installing darkfish documentation for builder-3.1.4
ERROR: While executing gem ... (RDoc::Error)
error generating /home/ray/.rvm/gems/ruby-2.0.0-p0/doc/builder-3.1.4/rdoc/doc/releases/builder-2_0_0_rdoc.html: U+201C from UTF-8 to US-ASCII (Encoding::UndefinedConversionError)
不知道这是什么问题呢?bundle 不起来。
Installing lazy_high_charts (1.3.3)
Gem::InstallError: lazy_high_charts requires RubyGems version ~> 1.3. Try 'gem update --system' to update RubyGems itself.
An error occurred while installing lazy_high_charts (1.3.3), and Bundler cannot continue.
Make sure that `gem install lazy_high_charts -v '1.3.3'` succeeds before bundling.
请问 Ruby2.0 后,为什么会出现上面的问题呢?
#49 楼 @gaicitadie 同问。。