文章列表
必须先在项目中要加入plugin
exception_notifier(附件就是)
然后
首先在development.rb文件中加入
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.a-it.jp",
:domain => "smtp.a-it.jp",
:port => 25,
:authentication => :lo ...
在你的rails3项目里面使用twitter's bootstrap
只需要安装一个gem包就ok了
快来试试吧!
gem 'less-rails-bootstrap'
相当简单,下载bootstrap可以到http://twitter.github.com/bootstrap/
去下载
更多关于less-rails-bootstrap的资料可以看
http://opinionatedprogrammer.com/2011/11/twitter-bootstrap-on-rails/
以及
https://github.com/twitter/bootstrap ...
如果你需要写很多batch方法,但是操作都是一样的,只是参数不一样而已,而你又不想传参数,就可以使用method_missing方法,rails中的find_by_方法就是利用这个来实现的。
def method_missing(sym, *args, &block)
if sym == :add_datas_to_user
add_datas('user')
else
super
end
end
[置顶] ruby Array等对象深拷贝
- 博客分类:
- Ruby 技术
浅拷贝:
a = [1, 2, 3, 4]
b = a
a << 5
pp a, b
#=> [1, 2, 3, 4, 5]
#=> [1, 2, 3, 4, 5]
深拷贝:
a = [1, 2, 3, 4]
b = a.dup
a << 5
pp a, b
#=> [1, 2, 3, 4, 5]
#=> [1, 2, 3, 4]
粘贴至Rails API
Caching stores
All the caching stores from ActiveSupport::Cache are available to be used as backends for Action Controller caching. This setting only affects action and fragment caching as page caching is always written to disk.
Configuration examples (MemoryStore is the default): ...