Class: Shelf

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.webObject



34
35
36
# File 'app/models/shelf.rb', line 34

def self.web
  Shelf.find(1)
end

Instance Method Details

#localized_display_nameObject



38
39
40
# File 'app/models/shelf.rb', line 38

def localized_display_name
  display_name.localize
end

#reset_positionObject



43
44
45
46
47
# File 'app/models/shelf.rb', line 43

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)


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

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