推荐自己的书,实在诚惶诚恐。
这是第一次写书,从 2 月 11 日到 6 月 29 日,总共用了四个半月的时间。书中的内容是按照自己的想法组织的,每个章节的内容来自对 Rails 手册的理解,api 的阅读体会,以及开发中的一点点心得。这本书,我一直称它为经验的合订本,也是写给自己多年开发经验的总结。
我的技术成长并非一帆风顺,在写这本书的时间里,我不断的回顾各种代码细节,也不断的补充知识内容。回头看来,这对我现在的项目开发很有益处。我想,一个人的技术成长有各自的方式,四个半月,可以做一个代码项目,也可以写出一本书来,从性格上,我更适合后者。
Ruby China 社区是国内最好的 Ruby 开发社区,这里有大量的经验分享,也有一群热心的人帮助解决开发中遇到的各种问题。能够从事 Rails 开发,并且身边有一个如此活跃、高质量的社区,实在是件幸运事。它对我的技术成长有着巨大的帮助,所以,这个社区会一直出现在书的感谢列表中。
现在,我把这本书正式的介绍给社区的朋友们。之前在社区里回复别人帖子的时候,贴过书里的连接,那时候,我觉得书的内容还不是很充分,所以只在自己微信朋友圈分享过,但得到的反馈还是有限的,作为一个写作上的新手,还是很期望得到别人更多的反馈。所以这次正式贴出来,希望朋友们不吝赐教,督促我改进和提高书中内容。
再次,感谢社区的朋友们。
感谢 lz,
http://rails-practice.com/content/Chapter_3/3.2.html
最后一行
代码在这里
,链接失效
如果什么时候准备出版的话,还是需要再仔细校正一些通假
字。
虽然大家都可以理解,但若是碰到完全的新手,难免会造成小小的误解。
我想这个肯定不是楼主所期望的。
#47 楼 @douxiance 是的,写的时候缺少经验,而且刚开始的时候过多口语化表达,难免有让人不解的用词。写到后面才感觉略好,用词拿捏也准确了一些。不过这个过程实在漫长,有时候像是自言自语,嘿嘿。
#60 楼 @ery 过奖了,真的,我只是个普普通通的开发者。
#58 楼 @easonlovewan 谢谢。从 4.0 开始,我经常翻 rails guides,因为有一年时间没有接触新版本 rails,所以从 3 到 4 的过程中发现很多陌生的地方,而且越来越觉得自己对 rails 的了解仅限于解决眼前的问题。手册翻了好多好多遍之后,我感觉很多的知识点是可以通过某些形式串联起来的,于是就想系统的把感悟写出来。我想,如果你很熟悉 rails guides 的话,这本书会帮助你熟悉 guides 中的内容如何应用到项目中。
再次感谢楼上各位朋友。
@dayudodo 真正的rails初学者
应该是指连HTML
这些 Web 有关的基础知识都未入门的小白
吧!
我想能从JSP
、PHP
、ASP.NET
等大众 Web 技术的重重封堵下坚定的看好·rails
的人应该都是过了那个小白
的关卡!
面对rails
有很多新手,但面对 Web 却都是老战友了。
#66 楼 @dayudodo #67 楼 @douxiance
我觉得初次接触 rails 的朋友,还是应该看看大家都看过的 Rails 敏捷开发,Rails way 这种书比较合适,或者网络上的课程,跟着视频写写代码,然后看看 Rails Guides 和 API 文档。当然,不管什么时候看这本书,都要同时看其他的资料,书里引用了大量的连接,包括其他一些优秀的书籍。
至于刚接触 web 编程的朋友,还是应该从 html,css,js 开始熟悉编程,了解原理。Ruby 是一个工具,可以帮助我们写出更好的 html。所以从事 web 开发,还是要从 html 开始比较合适吧。
看到书中第二章文件简介部分,就觉得遇到知音了,如果是我写,也是先把这些介绍清楚,在开始阶段,别的都是虚的,拿到一个项目哪个文件夹的文件是干什么的都搞不清楚,那基本没得玩了。赞一个。
不好意思,最近想体验一下 Ruby,于是看您的书学习,遇见个问题,百度了没找到解决方案,发帖又刚注册,比较尴尬,所以才借贵宝地提个问,学校最近更新网络架构,墙比较厉害,根本无法科学上网 Google,实在找不到了才来问的!
我是按照您的书步骤来的,安装好rvm
,在.zshrc
添加 PATH
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="$PATH:$HOME/.rvm/bin"
本机的一些参数,在 segmentfault 找到了一个淘宝源命令,改了一下源。
sed -i .bak 's!cache.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
➜ ~ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
➜ ~ gem -v
2.0.14
➜ ~ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
➜ ~ rails
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
rvm install 2.2.0
进行安装,能安装,但是报错如下,能 use,但是无法安装 rails。
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.2.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/Yugo/.rvm/rubies/ruby-2.2.0, this may take a while depending on your cpu(s)...
ruby-2.2.0 - #downloading ruby-2.2.0, this may take a while depending on your connection...
ruby-2.2.0 - #extracting ruby-2.2.0 to /Users/Yugo/.rvm/src/ruby-2.2.0 - please wait
ruby-2.2.0 - #applying patch /Users/Yugo/.rvm/patches/ruby/2.2.0/fix_installing_bundled_gems.patch - please wait
ruby-2.2.0 - #configuring - please wait
ruby-2.2.0 - #post-configuration - please wait
ruby-2.2.0 - #compiling - please wait
ruby-2.2.0 - #installing - please wait
Error running '__rvm_make install',
showing last 15 lines of /Users/Yugo/.rvm/log/1442124916_ruby-2.2.0/install.log
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/spec_fetcher.rb:42:in `fetcher'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/resolver/installer_set.rb:37:in `initialize'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/dependency_installer.rb:430:in `new'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/dependency_installer.rb:430:in `resolve_dependencies'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/dependency_installer.rb:373:in `install'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems.rb:558:in `install'
from ./tool/rbinstall.rb:717:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:716:in `each'
from ./tool/rbinstall.rb:716:in `block in <main>'
from ./tool/rbinstall.rb:749:in `call'
from ./tool/rbinstall.rb:749:in `block in <main>'
from ./tool/rbinstall.rb:746:in `each'
from ./tool/rbinstall.rb:746:in `<main>'
make: *** [do-install-nodoc] Error 1
+__rvm_make:0> return 2
There has been an error while running make install. Halting the installation.
#85 楼 @yugo hi,估计是网络问题,用下面的方法,把本地的数据源改成淘宝:
gem sources -l 查看列表
gem sources -r https://rubygems.org/ 删除掉本地的源
gem sources -a https://ruby.taobao.org/ 添加淘宝到环境
如果校验 cert 失败,可以不用 https://xxx,改成 http://xxxxx
然后再安装,对于没有安装成功的 gem,建议先 gem uninstall xxx,安装的时候,尤其是 rails,可以使用
gem install rails --no-ri --no-rdoc
可以节省时间。google 如果翻墙不行,可以用 bing.com 或百度,一些常见问题百度还是能找到一点靠谱答案的。
➜ ~ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
查看了一下就是淘宝的源。主要是安装 rvm install 2.2.0
出错,重新安装,涛声依旧。
😭,还是这个错误,我相信上天是公平的,毕竟颜值在那放着。我去试试 vagrant
,生命不息,折腾不止。
#89 楼 @chenge
it not worked.
#88 楼 @liwei78
这让我的命令行瞬间爆炸~
➜ ~ gem sources --remove https://ruby.taobao.org/
/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle
Reason: image not found - /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/psych.rb:1:in `<top (required)>'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/yaml.rb:5:in `<top (required)>'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems.rb:624:in `load_yaml'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/config_file.rb:328:in `load_file'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/config_file.rb:197:in `initialize'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `new'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:39:in `run'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/bin/gem:21:in `<main>'
➜ ~ gem sources -l
/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle
Reason: image not found - /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/psych.rb:1:in `<top (required)>'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/yaml.rb:5:in `<top (required)>'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems.rb:624:in `load_yaml'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/config_file.rb:328:in `load_file'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/config_file.rb:197:in `initialize'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `new'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:39:in `run'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/bin/gem:21:in `<main>'
➜ ~ gem sources -a http://ruby.taobao.org/
/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle
Reason: image not found - /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/psych.bundle
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/psych.rb:1:in `<top (required)>'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/yaml.rb:5:in `<top (required)>'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems.rb:624:in `load_yaml'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/config_file.rb:328:in `load_file'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/config_file.rb:197:in `initialize'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `new'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:39:in `run'
from /Users/Yugo/.rvm/rubies/ruby-2.2.0/bin/gem:21:in `<main>'
#90 楼 @yugo 建议你先按照 http://rvm.io/rvm/install 安装最新的 rvm,然后重新安装 ruby,目前可以装 ruby 2.2.2,写书的时候还是 2.2.0。
Error running '__rvm_make install'
,我是根据这个搜索的。
rvm get head
更新 rvm
rvm reinstall 2.2.0
重新安装。
试一下,不行的话,贴图看问题在哪里吧。
#89 楼 @chenge #86 楼 @liwei78 感谢您们的细心解答。我自己再研究研究,争取把坑全踩完,之后发一篇分享。 这是我 MAC 下面生成了 Log 文件,安装 2.2.1,依旧一样。不过我 vagrant 里面的安装成功了。
+__rvm_make:0> make install
config.status: creating x86_64-darwin14-fake.rb
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -I/usr/local/Cellar/libyaml/0.1.6_1/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin14 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/Cellar/libyaml/0.1.6_1/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -install_name /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/libruby.2.2.0.dylib -current_version 2.2.0 -compatibility_version 2.2.0 -fstack-protector -Wl,-u,_objc_msgSend -framework CoreFoundation -fstack-protector -Wl,-u,_objc_msgSend -framework CoreFoundation
SOLIBS = -lpthread -ldl -lobjc
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
making enc
make[1]: Nothing to be done for `enc'.
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
generating makefile exts.mk
Failed to configure -test-/win32/console. It will not be installed.
Failed to configure -test-/win32/dln. It will not be installed.
Failed to configure -test-/win32/dln/empty. It will not be installed.
Failed to configure -test-/win32/fd_setsize. It will not be installed.
Failed to configure gdbm. It will not be installed.
configuring socket
Failed to configure tk. It will not be installed.
Failed to configure tk/tkutil. It will not be installed.
Failed to configure win32. It will not be installed.
Failed to configure win32ole. It will not be installed.
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
installing default bigdecimal libraries
installing default date_core libraries
installing digest libraries
installing default digest libraries
installing default sha2 libraries
installing default fiddle libraries
make[2]: Nothing to be done for `all'.
installing default console libraries
installing default libraries
installing default nkf libraries
installing default openssl libraries
installing default pathname libraries
installing default psych libraries
installing default pty libraries
linking shared-object ripper.bundle
installing default ripper libraries
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
linking shared-object socket.bundle
installing default socket libraries
installing default syslog libraries
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make[2]: `ruby' is up to date.
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./x86_64-darwin14-fake ./tool/rbinstall.rb --make="/Applications/Xcode.app/Contents/Developer/usr/bin/make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc"
installing binary commands: /Users/Yugo/.rvm/rubies/ruby-2.2.0/bin
installing base libraries: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib
installing arch files: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14
installing pkgconfig data: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/pkgconfig
installing command scripts: /Users/Yugo/.rvm/rubies/ruby-2.2.0/bin
installing library scripts: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0
installing common headers: /Users/Yugo/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0
installing manpages: /Users/Yugo/.rvm/rubies/ruby-2.2.0/share/man/man1
installing extension objects: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14
installing extension objects: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/x86_64-darwin14
installing extension objects: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/vendor_ruby/2.2.0/x86_64-darwin14
installing extension headers: /Users/Yugo/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/x86_64-darwin14
installing extension scripts: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0
installing extension scripts: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0
installing extension scripts: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/vendor_ruby/2.2.0
installing extension headers: /Users/Yugo/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby
installing default gems: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
bigdecimal 1.2.6
io-console 0.4.3
json 1.8.1
psych 2.0.8
rake 10.4.2
rdoc 4.2.0
installing bundle gems: /Users/Yugo/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
/Users/Yugo/.rvm/src/ruby-2.2.0/lib/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/Yugo/.rvm/src/ruby-2.2.0/.ext/x86_64-darwin14/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/Yugo/.rvm/src/ruby-2.2.0/.ext/x86_64-darwin14/psych.bundle
Reason: image not found - /Users/Yugo/.rvm/src/ruby-2.2.0/.ext/x86_64-darwin14/psych.bundle
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/src/ruby-2.2.0/.ext/common/psych.rb:1:in `<top (required)>'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/yaml.rb:5:in `<top (required)>'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems.rb:624:in `load_yaml'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/config_file.rb:328:in `load_file'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/config_file.rb:197:in `initialize'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems.rb:297:in `new'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems.rb:297:in `configuration'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/remote_fetcher.rb:51:in `fetcher'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/spec_fetcher.rb:76:in `initialize'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/spec_fetcher.rb:42:in `new'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/spec_fetcher.rb:42:in `fetcher'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/resolver/installer_set.rb:37:in `initialize'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/dependency_installer.rb:430:in `new'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/dependency_installer.rb:430:in `resolve_dependencies'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems/dependency_installer.rb:373:in `install'
from /Users/Yugo/.rvm/src/ruby-2.2.0/lib/rubygems.rb:558:in `install'
from ./tool/rbinstall.rb:717:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:716:in `each'
from ./tool/rbinstall.rb:716:in `block in <main>'
from ./tool/rbinstall.rb:749:in `call'
from ./tool/rbinstall.rb:749:in `block in <main>'
from ./tool/rbinstall.rb:746:in `each'
from ./tool/rbinstall.rb:746:in `<main>'
make: *** [do-install-nodoc] Error 1
+__rvm_make:0> return 2
#93 楼 @yugo 说实在的,看 log 不是个愉快的事情。我搜索了第一个 error。
来自这个链接: http://stackoverflow.com/questions/9434002/how-to-solve-ruby-installation-is-missing-psych-error
@liwei78 李伟出书的贴子必段要顶一下,想当年我们合作开发百草网,用得是 rails 2.2。后面我们准备重走 rails 之路,再用 rails 做个论坛,呵呵。
感谢楼上的肯定。
#108 楼 @coder_zzx Ruby 的学习资料我没有太多,这里有一些 Rails 的资料 http://railsgirlschina.org/topics/64
另:我只是个普普通通的开发者 :)
#108 楼 @coder_zzx 学 ruby 可以试试我的这个:http://blog.csdn.net/freeagle/article/details/46659351
看第一章 第三节
执行:rails g scaffold product name price:decimal description:text
出现错误提示:.rvm/gems/[email protected]/gems/less-rails-2.7.0/lib/less/rails/railtie.rb:19:in block in <class:Railtie>': undefined method
register_preprocessor' for nil:NilClass (NoMethodError)
楼主能帮看看吗?试了半天过不去啊
#117 楼 @hxygsh 请重新 bundle install 试试,或者 clone 这个代码试试 https://github.com/liwei78/rails-practice-code/tree/master/chapter_1/shop
#132 楼 @775343518 暂时没有计划出纸质书,目前的重点是积累经验,对于非技术的事情木有计划。
写书还是新手,最近看了很多书,也学到很多写作技巧,在完成最近的开发任务后,会对书里的内容做一个整理和增补的 :)
再次感谢楼上各位的关注和鼓励,谢谢大家。
@liwei78 3.3 以后的代码在 ruby2.2.1,rails4.2.5 下貌似都报错 variable @ glyphiconsEotPath is undefined 错误,是 gem 没更新吗?
#61 楼 @liwei78 手册翻了好多好多遍之后,我感觉很多的知识点是可以通过某些形式串联起来的,于是就想系统的把感悟写出来。严重同意楼主的观点。 说一下我自己学习 Rails 的经历吧。
本人会 Java,之前完全没有接触过 Ruby/Rails
最初激起我学 rails 兴趣的是Cloud 9上的 Rails Tutorial 模板。 该模板基于Michael Hartl 的书 Ruby on Rails Tutorial,为用户提供了一下在线学习 Rails 的易用环境,无需为 Ruby/Rails/git/Heroku 等的安装为烦恼,所以这些在你创建了 workspace 后即可以使用。 我非常喜欢 Tutorial 系列的教程,可以按照教程中的步骤一步步实践,在学习 Rails 的同时,Micheal 还顺带教大家如何使用 git/bitbucket/heroku 这些非常流行的工具/平台。