Class: Property

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/property.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Array[Property]) admin_grid(params = {})

paginated results from the admin Property grid

Parameters:

  • (Optional params)

Returns:



26
27
28
29
30
31
32
33
34
35
# File 'app/models/property.rb', line 26

def self.admin_grid(params = {})

  grid = Property
  grid = grid.where("active = ?",true)                    unless  params[:show_all].present? &&
                                                            params[:show_all] == 'true'
  grid = grid.where("properties.display_name LIKE ?", "#{params[:display_name]}%")  if params[:display_name].present?
  grid = grid.where("properties.identifing_name LIKE ?", "#{params[:identifing_name]}%")  if params[:identifing_name].present?
  grid

end

Instance Method Details

- (String) display_active

'True' if active 'False' otherwise in plain english

Parameters:

  • (none)

Returns:

  • (String)

    'True' or 'False'



41
42
43
# File 'app/models/property.rb', line 41

def display_active
  active? ? 'True' : 'False'
end

- (Object) full_name



19
20
21
# File 'app/models/property.rb', line 19

def full_name
  "#{display_name}: (#{identifing_name})"
end