我能够根据母子的特性过滤物体:
class Call < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_many :calls
end
我能够这样做:
ActiveAdmin.register Call do
filter :user
end
用户名,而不是提供所有用户的选择。 能否做到这一点?
我能够根据母子的特性过滤物体:
class Call < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_many :calls
end
我能够这样做:
ActiveAdmin.register Call do
filter :user
end
用户名,而不是提供所有用户的选择。 能否做到这一点?
丹尼斯的解决方案几乎对我有利。 我只需要增加过滤器。 例如:
ActiveAdmin.register Call do
filter :user_name, :as => :string
end
为此:
ActiveAdmin.register Call do
filter :user_name
end
Since ActiveAdmin uses meta_search
for filters their doc is very helpful: https://github.com/ernie/meta_search
在下一期发行的活性污染物(与1.0.0.pre合作)中,可使用Ransack方法。 因此,我要说的是一条属于用户的条款。
页: 1
ActiveAdmin.register Article do
controller do
def scoped_collection
Article.includes(:user)
end
end
index do
column :id
column :created_at
column :title
column("Author", sortable: users.first_name ) { |item| link_to item.user.full_name, user_path(item.user) }
actions
end
filter :user_first_name_cont, :as => :string
filter :user_last_name_cont, :as => :string
end
这里,用户——名称_cont_是洗衣方法,首先对相关用户进行过滤——姓名和连续手段包含。
您可以使用由主动提名人使用的专用资源,因此,你的名单自动由父母过滤。
ActiveAdmin.register User do
# this is the parent resource
end
ActiveAdmin.register Call do
belongs_to :user # nested below resource user
end
之后,你可以使用 r车路线,看看活性污染物产生的新通道: 希望会有助于
d 我说,这在很大程度上取决于你在模式之间有什么样的协会——我需要几个小时来说明这一点。
例
class User < ActiveRecord::Base
belongs_to :user
end
class Email < ActiveRecord::Base
has_one :email
end
为了根据电子邮件对用户进行过滤,你这样做(登机忘记as:string<>code>。 部分内容是使你能够使用Lansack搜身方法,如 contains具等。
ActiveAdmin.register User do
filter :user_email, :as => :string
end
collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...
We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...
As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...
I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?
I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...
I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml
guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...
I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...