Class: Prototype

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

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

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

paginated results from the admin Prototype grid

Parameters:

  • (Optional params)

Returns:



15
16
17
18
19
20
21
22
23
# File 'app/models/prototype.rb', line 15

def self.admin_grid(params = {})

  grid = Prototype
  grid = grid.where("active = ?",true)                    unless  params[:show_all].present? &&
                                                            params[:show_all] == 'true'
  grid = grid.where("prototypes.name LIKE ?", "#{params[:name]}%")  if params[: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'



29
30
31
# File 'app/models/prototype.rb', line 29

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