我想在我的Google云端硬盘目录(或子目录)中添加,删除或修改文件时,我的应用会收到通知.Google云端硬盘支持webhooks类似的第三方集成机制吗?我在API文档中找不到类似的东西.
提前致谢.
我有库代码覆盖了Ar的find方法.我还为所有Association类包含了模块,因此MyModel.find和@ parent.my_models.find都可以工作并应用正确的范围.
我的代码基于will_paginate:
a = ActiveRecord::Associations
returning([ a::AssociationCollection ]) { |classes|
# detect http://dev.rubyonrails.org/changeset/9230
unless a::HasManyThroughAssociation.superclass == a::HasManyAssociation
classes << a::HasManyThroughAssociation
end
}.each do |klass|
klass.send :include, Finder::ClassMethods
klass.class_eval { alias_method_chain :method_missing, :paginate }
end
Run Code Online (Sandbox Code Playgroud)
我的问题是,我只想覆盖某些型号的查找器.目前,我需要扩展所有模型共享的所有关联集合类.我知道我可以通过传递一个模块扩展每个模型的关联:
has_many :things, :extend => SomeCustomMethods
Run Code Online (Sandbox Code Playgroud)
但我的库基本上是ActiveRecord插件,所以我想要一个适用于模型和范围集合的可插入finder扩展的简洁约定,而不会影响应用程序中的所有模型.
在我的视图中,我使用一个将任意HTML作为块的帮助器:
<% some_block_helper do %>
Some arbitrary HTML and ERB variables here.
More HTML here.
<% end %>
Run Code Online (Sandbox Code Playgroud)
在将其渲染回视图(Markdown和其他格式化)之前,我的助手会对传递的HTML块执行大量操作.我想知道在rSpec中测试helper调用结果的最简洁方法是什么,如果有的话.我发现了一些与ERB私有方法有关的例子,但这看起来有点脆弱,难以阅读.