gem install passenger
yum install apr-devel
yum install apr-util-devel
yum install httpd-devel
passenger-install-apache2-module
复杂以下文件到httpd.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p290-module/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p290-module/gems/passenger-3.0.9
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p290-module/ruby
#For PAIFAN 后台
<VirtualHost *:80>
ServerName padmin.qdigit.cn
RailsEnv production
#RailsEnv development
DocumentRoot /var/www/html/admin.insta/public
ErrorLog /var/www/html/admin.insta/log/redmine.error.log
<Directory /var/www/html/admin.insta/public>
AllowOverride all
#Options -MultiViews [...]
Also filed in
|
|
irb(main):002:0> require ‘rubygems’
=> true
irb(main):003:0> require ‘redis’
=> true
irb(main):004:0> r = Redis.new
=> #<Redis:0×8605b64 @sock=#<TCPSocket:0×8605ab0>, @timeout=5, @port=6379, @db=0, @host="127.0.0.1">
irb(main):005:0> r.keys(’*')
列出某个的key的值:
r.sort("Listen:1")
Also filed in
|
|
在了解 Moutable之前, 先看这个视频:
http://railscasts.com/episodes/277-mountable-engines
了解Mountable Engines与Full Engines的区别, 看这篇文章:
http://stackoverflow.com/questions/6118905/rails-3-1-engine-vs-mountable-app
当我们使用:
rails plugin new uhoh –mountable
我们可以把这个创建好的plugin变成一个gem来使用。
比如我们可以先创建一个rails app
rails new with_engine -T -O -J
编辑Gemfile, 添加以下一行:
gem ‘uhoh’, :path => ‘/Users/weston/Downloads/277-mountable-engines/uhoh-after/’ #刚才创建的mountable 路径
执行
bundle install
vim config/routs.rb
添加以下一行:
mount Uhoh::Engine => "/uhoh", :as => "uhoh_engine"
这样我们就可以使用这个engines了…
Also filed in
|
|
可以参考:
http://stackoverflow.com/questions/1531514/observers-vs-callbacks
其中有一段是这样的:
class Model < ActiveRecord::Base
before_update :disallow_bob
def disallow_bob
return false if model.name == "bob"
end
end
class ModelObserver < ActiveRecord::Observer
def before_update(model)
return false if model.name == "mary"
end
end
m = Model.create(:name => "whatever")
m.update_attributes(:name => "bob")
=> false — name will still be "whatever" in database
m.update_attributes(:name => "mary")
=> true — [...]
Also filed in
|
|
来源:http://jimdrannbauer.com/2011/01/29/rails-3-rspec-cucumber-jquery-devise-mongoid-and-compass/
Want to build a Rails 3 app with this stuff?
Git
RSpec
Cucumber w/ Capybara
Mongoid
Devise
CanCan
jQuery
Compass
Blueprintcss
Haml
Sass
Capistrano
Passenger
Factory Girl
Shoulda
metric_fu
Here’s how.
Just A Checklist
This article is mostly written for myself so I don’t have to remember where I found all of the information. There’s nothing particularly difficult about anything here. I just like the idea of having it all in one place. I [...]
Also filed in
|
|
source ‘http://rubygems.org’
# ——————–
# Rails
# ——————–
# gem ‘rails’, ‘~> 3.0.0′
gem ‘rails’, :git => ‘git://github.com/rails/rails.git’, [...]
Also filed in
|
|
在Rails3 出现这个错误,做以下工作:
1. 在Gemfile
gem ‘mysql2′, ‘~> 0.2.6′
2.
bundle update
3. 在datababse.yml
development:
adapter: mysql2
encoding: utf8
database: devise
# pool: 5
username: root
password:
reconnect: true
socket: /tmp/mysql.sock
参考: http://stackoverflow.com/questions/4297253/install-mysql2-gem-on-snow-leopard-for-rails-3-with-rvm
Also filed in
|
|
cc -c -o source.c target.o
或者可以把其做成lib
gcc -g -c source.c
ar -rc libsource.a source.o