Skip to content

Commit

Permalink
Use domain model function select options. Added garbage collection to
Browse files Browse the repository at this point in the history
user segment cache.
  • Loading branch information
Doug Youch committed May 25, 2010
1 parent 08b6f8b commit e09e47f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/user_segment/field_type.rb
Expand Up @@ -83,7 +83,7 @@ def self.convert_to(value, type, opts={})
end

def self.model_options(opts={})
opts[:class].find(:all, {:select => 'id, name', :order => 'name'}.merge(opts[:options] || {})).collect { |item| [item.name, item.id] }
opts[:class].select_options
end

def self.convert_arguments(arguments, types, options)
Expand Down
2 changes: 2 additions & 0 deletions app/models/user_segment_cache.rb
Expand Up @@ -56,6 +56,8 @@ def find_in_batches(opts={})
users = self.fetch_users(:offset => offset, :limit => limit)
offset = offset + limit
yield users
users = nil
GC.start
end
end

Expand Down

0 comments on commit e09e47f

Please sign in to comment.