找提供私有网络的提供商,例如 https://www.digitalocean.com/company/blog/introducing-private-networking/
自己做的话,就是不接入公网。
不过以前看过分享说 Github 用的语言也不少的,https://hubot.github.com/ 就是用 coffeescript。
为什么说“为什么都说 Devise 很慢?”?
这段代码是在 head 插入 script 引入外部脚本然后立即执行,试试去掉这段代码,在 </body>
前插入
<script src="//static.duoshuo.com/embed.js" async></script>
标题很无聊。
如果你说的是生成 url。
def to_param
"#{first_name}-#{last_name}"
end
定义一个方法不就好了。
def find_by_friendly_id(id)
first_name, last_name = id.split('-')
find_by! first_name: first_name, last_name: last_name
end
#7 楼 @nowherekai 用 memcached 或 redis。
def show
if Rails.cache.increment("login/ip/#{request.ip}", 0, expires_in: 10.minutes).to_i > 3
render :ip_limit
else
# login form
end
end
def create
if Rails.cache.increment("login/ip/#{request.ip}", 1, expires_in: 10.minutes) > 3
render :ip_limit
else
if success
# login
Rails.cache.delete("login/ip/#{request.ip}")
else
# render :show
end
end
end
补充:
发代码不要用截图。
class User
has_many :memberships
has_many :circles, through: :memberships do
# Association Extensions
def status(status)
where(memberships: { status: status })
end
end
end
class Membership
belongs_to :user
belongs_to :circles
end
class Circle
has_many :memberships
has_many :users, through: :memberships
end
# Association
User.first.circles.where(memberships: { status: status})
# Association Extensions
User.first.circles.status(status)
Circle.joins(:memberships).where(memberships: { status: status, user_id: id })
#2 楼 @gztheknot pass
https://ruby-china.org/topics/25579
请不要包含如“公司美女如云”等不符合技术社区价值观的内容,如果发布类似“急招 Ruby 程序员,QQ 号 xxxxx”这样的马路小广告式的招聘贴,见一个,删一个,决不姑息!
启动了 worker 没?
#4 楼 @liguangsong 可能默认加载的 jquery-ujs 被去掉了,看看 application.js
用 POST
#16 楼 @zhangjinzhu 我第一时间看不懂,以为 SELECT
语句是对应最后一行代码。
调试了一下,似乎 find_or_create
语法没有这个问题。试试:
order.items.find_or_create_by(product_id: 888)