Class: ItemsRepository

Inherits:
DefaultRepository show all
Defined in:
app/repositories/items_repository.rb

Instance Attribute Summary

Attributes inherited from DefaultRepository

#klass

Instance Method Summary collapse

Methods inherited from DefaultRepository

#all, #create, #find, #find_all, #find_or_initialize, #initialize, #new

Constructor Details

This class inherits a constructor from DefaultRepository

Instance Method Details


2
3
4
5
6
7
8
9
# File 'app/repositories/items_repository.rb', line 2

def update_link_and_image(name, link_url, image_url)
  item = find_or_initialize(name: name)
  item.link_url = link_url
  item.image_url = image_url
  item.save if item.changed?

  item
end