By @quakewang
以下是广告时间
因为
因为
1.upto(3) {|i| puts i}
1
2
3
"The quick brown fox jumps over the lazy dog".downcase.split("").uniq.sort.join
" abcdefghijklmnopqrstuvwxyz"
class Time
def yesterday
self - 86400
end
end
today = Time.now
yesterday = today.yesterday
COLORS = { black: "000",
red: "f00",
green: "0f0",
yellow: "ff0",
blue: "00f"
}
class String
COLORS.each do |color,code|
define_method "in_#{color}" do
"<span style='color: ##{code}'>#{self}</span>"
end
end
end
"Hello, World!".in_blue
=> "<span style='color: #00f'>Hello, World!</span>"
ActiveRecord
User.create(name: "David", occupation: "Code Artist")
Blog.where(created_at: 1.week.ago.beginning_of_week..1.week.ago.end_of_week).order(view_counts: :desc).first.subject
Resource Routing
resources :trips
namespace :api do
resources :trips
end
Web开发最佳实践
为我们这种创业团队解决如下问题
为我们这种UGC项目解决如下问题
最后还要广告:蝉游记