* Move from OpenStruct to Struct in Organization * Add data update script * Introduce Articles::CachedEntity model * Update data update script for new model * Fix comment * Update jbuilder
14 lines
452 B
Ruby
14 lines
452 B
Ruby
module Articles
|
|
# NOTE: articles cache either users or organizations, but they have the same attributes.
|
|
CachedEntity = Struct.new(:name, :username, :slug, :profile_image_90, :profile_image_url) do
|
|
def self.from_object(object)
|
|
new(
|
|
object.name,
|
|
object.username,
|
|
object.respond_to?(:slug) ? object.slug : object.username,
|
|
object.profile_image_90,
|
|
object.profile_image_url,
|
|
)
|
|
end
|
|
end
|
|
end
|