Class: CloudObject::Action

Inherits:
ApplicationLesliRecord
  • Object
show all
Defined in:
app/models/lesli/cloud_object/action.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cloud_object_modelClass

Returns The class of the association ‘belongs_to’.

Examples:

puts DeutscheLeibrenten::Project::File.cloud_object_model.new # This will display an instance of DeutscheLeibrenten::Project

Returns:

  • (Class)

    The class of the association ‘belongs_to’



44
45
46
# File 'app/models/lesli/cloud_object/action.rb', line 44

def self.cloud_object_model
    self.reflect_on_association(:cloud_object).klass
end

.index(curren_user, cloud_object) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/models/lesli/cloud_object/action.rb', line 48

def self.index(curren_user, cloud_object)
    action_groups = {}
    cloud_object.actions.order(group: :asc).map do |action|
        action_attributes = action.attributes.merge({
            "user_creator_name" => action.user_creator.full_name,
            "created_at_text" => LC::Date.to_string(action.created_at)
        })
        action_groups[action.group] = [] unless action_groups[action.group]
        
        action_groups[action.group].push(action_attributes)
    end

    action_groups
end

Instance Method Details

#show(current_user) ⇒ Object



63
64
65
66
67
68
# File 'app/models/lesli/cloud_object/action.rb', line 63

def show(current_user)
    attributes.merge({
        "user_creator_name" => user_creator.full_name,
        "created_at_text" => LC::Date.to_string(created_at)
    })
end