Class: Shelf

Inherits:
ApplicationRecord
  • Object
show all
Includes:
MasterModel
Defined in:
app/models/shelf.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.webObject



36
37
38
# File 'app/models/shelf.rb', line 36

def self.web
  Shelf.find(1)
end

Instance Method Details

#localized_display_nameObject



40
41
42
# File 'app/models/shelf.rb', line 40

def localized_display_name
  display_name.localize
end

#reset_positionObject



45
46
47
48
49
# File 'app/models/shelf.rb', line 45

def reset_position
  if library_id_changed?
    self.position = library.shelves.count > 0 ? library.shelves.last.position + 1 : 1
  end
end

#web_shelf?Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'app/models/shelf.rb', line 31

def web_shelf?
  return true if id == 1
  false
end