Class: Dawanda::Shop
Overview
Shop
Represents a single Dawanda shop. Users may or may not have an associated shop - check the result of User#seller? to find out.
A shop has the following attributes:
- name
-
The shop’s name
- title
-
A brief heading for the shop’s main page
- announcement
-
An announcement to buyers (displays on the shop’s home page)
- message
-
The message sent to users who buy from this shop
- banner_image_url
-
The full URL to the shops’s banner image
- listing_count
-
The total number of active listings contained in this shop
Instance Method Summary collapse
-
#created_at ⇒ Object
Time that this shop was created.
-
#products ⇒ Object
A collection of listings in this user’s shop.
-
#updated_at ⇒ Object
Time that this shop was last updated.
- #user ⇒ Object
Methods included from Model
Instance Method Details
#created_at ⇒ Object
Time that this shop was created
31 32 33 |
# File 'lib/dawanda/shop.rb', line 31 def created_at Time.parse(created) end |
#products ⇒ Object
A collection of listings in this user’s shop. See Dawanda::Listing for more information
44 45 46 |
# File 'lib/dawanda/shop.rb', line 44 def products @products ||= Product.find_all_by_shop_id(user_id.to_s) end |
#updated_at ⇒ Object
Time that this shop was last updated
37 38 39 |
# File 'lib/dawanda/shop.rb', line 37 def updated_at Time.parse(updated) end |
#user ⇒ Object
48 49 50 |
# File 'lib/dawanda/shop.rb', line 48 def user @user ||= User.find_by_user_id(user_id) end |