Class: Album
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Album
- Defined in:
- app/models/album.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.page(search, page) ⇒ Object
9 10 11 |
# File 'app/models/album.rb', line 9 def self.page(search, page) (:manage).search(search).order("title").paginate(:per_page => 10, :page => page) end |
.search(search) ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/models/album.rb', line 13 def self.search(search) if search where("title LIKE ?", "%#{search}%") else scoped end end |
Instance Method Details
#create_menu_item ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'app/models/album.rb', line 39 def @menu_item = self.( :title => self.title, :url => "/photos-for/#{self.filename}", :active => self.active ) @menu_item.save end |
#update_menu_item ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/album.rb', line 26 def @menu_item = self. if @menu_item == nil self. else @menu_item.update_attributes( :title => self.title, :url => "/photos-for/#{self.filename}", :active => self.active ) end end |