Permalink
Browse files

Added support for time

  • Loading branch information...
1 parent 1cf577e commit 1540a5c2eadd5ded991d438bbaa9c611393f9553 @Ostrzy committed Jul 27, 2012
Showing with 6 additions and 2 deletions.
  1. +5 −1 lib/active_admin/mongoid/adaptor.rb
  2. +1 −1 lib/active_admin/mongoid/filter_form_builder.rb
@@ -26,7 +26,7 @@ def method_missing(method_id, *args, &block)
private
def is_query(method_id)
- method_id.to_s =~ /_(contains|eq|gt|lt)$/
+ method_id.to_s =~ /_(contains|eq|gt|lt|gte|lte)$/
end
def get_query_hash(search_params)
@@ -46,6 +46,10 @@ def mongoidify_search(k, v)
[get_attribute(k, "_gt").to_sym.gt, v]
when /_lt$/
[get_attribute(k, "_lt").to_sym.lt, v]
+ when /_gte$/
+ [get_attribute(k, "_gte").to_sym.gte, v]
+ when /_lte$/
+ [get_attribute(k, "_lte").to_sym.lte, v]
else
[k, v]
end
@@ -2,7 +2,7 @@ class ActiveAdmin::FilterFormBuilder
def default_input_type(method, options = {})
if column = column_for(method)
case column.type.name.downcase.to_sym
- when :date, :datetime
+ when :date, :datetime, :time
return :date_range
when :string, :text
return :string

1 comment on commit 1540a5c

@satelin2002

i added

gem 'activeadmin-mongoid', :git => 'git://github.com/Ostrzy/activeadmin-mongoid.git', :branch => 'filter_support'

to my Gemfile.

and in my admin/users.rb

ActiveAdmin.register User do

filter :email, :as => :string

index do
column :fullname
column :first_name
column :last_name
column :email
column :created_at
column :current_sign_in_at
column :last_sign_in_at
column :isactive
column :temp_password
column :id
default_actions
end
form :partial => "form"

end

The filter does not show up still. I am using mongoid 2.4 .

Please sign in to comment.