单数和复数形式相同,并且在尝试使用New方法时遇到undefined_method错误。
我知道为什么,并且我知道最简单的解决方案是使用其他名称。
我也知道我可以创建自定义拐点,但是呢?
问题是我确实需要/ series,/ series / 1等URL,因为我实际上是在建模...等待它...一系列事件。
使用“ set”或“ sequence”或其他同义词不能传达预期的含义。
一系列事件是一系列而不是集合或序列。
有没有办法“混淆”模型?
我应该/可以使用命名路线吗?
任何帮助表示赞赏。
我想在过去7天内使用Seer实现一个显示新用户的滚动图表.
我安装了Seer:
http://www.idolhands.com/ruby-on-rails/gems-plugins-and-engines/graphing-for-ruby-on-rails-with-seer
我正在努力让我的大脑围绕如何实施.
我有一个我想要绘制的用户数组:
@users = User.all(:conditions => {:created_at => 7.days.ago..Time.zone.now})
无法通过created_at日期查看正确的方法来实现:data_method将它们汇总.
任何与Seer完成此类或类似操作的人?
在查看Seer示例页面(上面链接)之后,任何比我聪明的人都能解释这个问题?
鉴于以下API定义,我需要能够按产品别名过滤事件.
鉴于一个事件属于一个Job而一个Job属于一个产品,我不知道如何规范.
api.py:
class ProductResource(ModelResource):
class Meta:
queryset = Product.objects.all()
resource_name = 'product'
allowed_methods = ['get']
excludes = ['created_at','updated_at']
filtering = {
'alias': ALL
}
class EnvironmentResource(ModelResource):
class Meta:
queryset = Environment.objects.all()
resource_name = 'environment'
allowed_methods = ['get']
excludes = ['created_at','updated_at']
class JobResource(ModelResource):
product = fields.ForeignKey(ProductResource, 'product')
class Meta:
queryset = Job.objects.all()
resource_name = 'job'
allowed_methods = ['get']
excludes = ['created_at','updated_at']
class EventResource(ModelResource):
environment = fields.ForeignKey(EnvironmentResource, 'environment',full=True)
job = fields.ForeignKey(JobResource, 'job',full=True)
class Meta:
queryset = Event.objects.all()
resource_name = 'event'
allowed_methods …Run Code Online (Sandbox Code Playgroud) 我很确定这是微不足道的,但对于我的生活,我似乎无法找到参考.
任何帮助表示赞赏.
我有一个带有嵌套对象的表单,如下所述:
http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
它工作正常,但我需要通过"name"属性对表单中的嵌套对象进行排序,以便按字母顺序列出.
有任何想法吗?