`
sitoto
  • 浏览: 120097 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论
文章列表
sqlite3-ruby gem can't find sqlite3.h on ubuntu In my case I had to install libsqlite3-dev sudo apt-get install libsqlite3-dev
NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE =============== add  in Gemfile gem 'net-ssh', :git => 'git://github.com/nessche/net-ssh.git' bundel exec deploy:setup ==== http://stackoverflow.com/questions/10741936/capistrano-nameerror-uninitialized-constant-netsshkno ...
I'm really new to refinery and fairly new to rails overall. I've succesfully installed refinery and it's working great, except when I want to add an image. I get the following error: Dragonfly::ImageMagickUtils::ShellCommandFailed in Admin/ imagesController#create I'm not sure what might be caus ...

ImageMagick in ubuntu

ImageMagick is a powerful suite of tools in Ubuntu for scripting batch manipulations of images. Conversion between formats, resizing and hundreds of sophisticated filters can all be automated with only a few keystrokes. For that reason, it is popular with web developers, photographers and other users ...
I just made a breadcrumb for my site and put it in _content_page.html: <% unless @page.home? %>         <ul id="breadcrumb">                 <li><%= link_to "Home", root_url(:only_path => true) %> &gt; </li>                 <% [@page.anc ...

Rake

    博客分类:
  • ruby
Rake Rake lets you define a dependency tree of tasks to be executed Rake tasks are loaded from the file Rakefile Rails rake tasks are under railties/lib/tasks Put your custom tasks under lib/tasks Userful Rake Tasks db:migrate db:sessions:create doc:app doc:rails log:clear rails:freeze:gems rails: ...

Constraint

get '/mobile' => 'posts#index' , :constraint => { :use_agent => /iPhone/}, :default => { :mobile => true }
rails2.*  里面的写法 named_scope  rails3.*  里面 去掉 named_  就直接 scope 如:rails 2. class Item   named_scope :red, :conditions => { :colour => 'red' }   named_scope :since, lambda {|time| {:conditions => ["created_at > ?", time] }} end rails 3. class Item   scope :red, :conditions ...
Hash 和相等性 ActiveRecord 的 hash 值是根据主键的值计算出来的,这就意味着未保存对象的 hash 值是不可靠的。同样两个 model 对象的相等比较(即==操作符)也是基于主键的,所以两个 model 对象即使它们的其他属性不一样,仍有可能被当作相等。 查找 find_by_attribute 方法后面加个 ! 号,即使用 find_by_attribute!,就能在找不到对象的时候触发一个 RecordNotFound 异常,而不是返回 nil。 find_or_initialize_by 和 find_or_create_by 也是两个好用的方法,它们在找不到 ...

parameterize

    博客分类:
  • ruby
parameterize :替换掉特殊字符,让它看起来像个漂亮的url,主要是根据正则表达式 ,替换掉非字母、数字及下划线的字符。。中文也将被替换掉。。。。那就没的搞了。 中文的 url 还是要自己去定义了。 ================ parameterize(string, sep = '-') Replaces special characters in a string so that it may be used as part of a ‘pretty’ URL. Examples class Person   def to_param     "#{id}-# ...
怎么让Vim不自动生成这些备份文件呢? 1. 找到你的Vim安装目录,如果是在Windows下默认路径安装的,应该是在C:\Program Files\Vim\ 2. 找到这个文件:vimrc_example.vim ,我的这个文件是在vim70文件夹下,具体还要看你安装的是什么版本的。 3. 找到后打开,找到这一句:if has("vms") 把这个判断里的if部分保留,else部分注释掉。(Vim的注释符是")即修改后应该是这样的: if has("vms") set nobackup " do not keep a bac ...
Hi, For some reason I cannot get WEBrick to boot anymore. I installed and used Eclipse yesterday and all was working fine but today I m getting this:   $ ruby script/server => Booting WEBrick... => Rails application started on http://127.0.0.1:3000 => Ctrl-C to shutdown ...
启动redis时候提示:   ARE YOU SURE YOU WANT TO USE VM? Redis Virtual Memory is going to be deprecated soon, we think you should NOT use it, but use Redis only if your data is suitable for an in-memory database. If you *really* want VM add this in the config file: really-use-vm yes 本机测试 ...
http://www.mongodb.org/downloads   From: http://blog.csdn.net/sheismylife/article/details/6737127   ================= 获取最新版本 wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.2.tgz 解压缩即可执行 tar zxvf mongodb-linux-x86_64-2.0.2.tgz cd /usr/mongodb-linux-x86_64-2.0.2/bin 但是在运行 ...
From: http://junnan.org/blog/1454   安装说明: 本文是以root用户为例进行安装,如用普通用户,某些命令前需加sudo。 安装过程特别是用RubyGems和Git安装时,下载很慢,可以参考 《Ubuntu下使用proxychains为程序做全局代理 》来加快下载速度。 环境: Ubuntu Server版本:11.10 Ruby版本:1.9.2 RubyGems版本: 1.8.11 Rails版本: 3.1.3 Node.js版本: 0.6.9 MongoDB版本:2.0.1 Redis版本:2.4.2 系统基本 ...
Global site tag (gtag.js) - Google Analytics