摘要:
首先安装nginx下载:http://archive.ubuntu.com/ubuntu/pool/universe/n/nginx/nginx_1.1.19.orig.tar.gz目前在ubuntu中安装的是1.1.19版本,下载的1.3.13版本的安装有问题,所以就降低了一下版本.下载下来之后解压tar xzvf nginx_1.1.19.orig.tar.gzcd nginx_1.1.19.orig.tar.gzsudo ./configure --prefix=/usr/local/nginx --with-debug --with-http_addition_module --wit 阅读全文
摘要:
Failed to build gem native extension这是由于缺少了libmysqlclient-devsudo apt-get install libmysqlclient-dev即可! 阅读全文
摘要:
Rake is a simple ruby build program similar to make. There are many versions of Rake are available. If you are using Rake-0.9.x you might come to the error, “wrong number of arguments (1 for 0) (ArgumentError)”. While the same piece of code runs without error on Rake-0.8.x. Here you will find the tw 阅读全文
摘要:
Some time you may need to uninstall all the installed Ruby gems. Uninstalling individual gems is tedious job. Here you will find how to uninstall all the installed Ruby gems using single command.First, we need a list of installed gems. Its easier to get list of installed gems by using the command:ge 阅读全文
摘要:
Gemfile gem 'sunspot_rails'gem 'sunspot_solr'然后执行 bundle之后就是rails g sunspot:solr:install生成一个config/sunspot.yml文件,不需要管理这个生成文件然后执行bundle exec rake sunspot:solr:startclass Post < ActiveRecord::Base searchable do text :title, :body text :comments do comments.map { |comment| comment.bo 阅读全文
摘要:
$ wget http://redis.googlecode.com/files/redis-2.6.0.tar.gz $ tar xzf redis-2.6.0.tar.gz$ cd redis-2.6.0 $ make然后make test出现一个错误缺少tcl,这个时候可以sudo apt-get install tcl然后在sudo make test不会出现错误了。$sudo make install这时Redis 的可执行文件被放到了/usr/local/bin2、下载配置文件和init启动脚本:wget https://github.com/ijonas/dotfiles/raw 阅读全文
摘要:
strftime format codes for Ruby on RailsYear%Y year with century 2011%y year without century 11%C century number (year divided by 100) 20Month%B full month name January%b abbreviated month name Jan%h same as %b Jan%m month as number (01-12)Week%U week number of the year, Sunday as first d... 阅读全文
摘要:
首先是不为空validates :name,presence:{message:'blank is not allowed'}唯一性:validates :name,uniqueness:{message:'already exist!',case_sensitive: false}#case_sensitive区分大小写长度:validates :name,length:{in: 6..20,message:'must in 6-20 byte'} 格式:validates :name,format:{with: /[a-z]/,message 阅读全文
摘要:
前天在使用mongoid的时候用了class Article include Mongoid::Document field :name field :content field :published_on, type: Dateend 在相应的视图中添加了一些对应属性的试图<%= f.date_select :published_on %> 当创建一个article成功后,在展现的html中published_on对应的是空的,后来在数据库中查看了一下,插入进去了,但是插入的不是published_on而是变成了三个属性published_on(1i) 和 published_o 阅读全文
摘要:
每天学一点,天天都是进步!content_for在次模板中使用,比如index.html.erb或者其他,对应的yield在主模板中使用,对于index.html.erb来说的application.html.erb中使用。在index.html.erb中有如下代码:<% content_for(:list) do %> <ol> <% for i in 1..5 %> <li>I'm <%= i %> !</li> <% end %> </ol><% end %> 然后在app 阅读全文