Class: UUCounter::Track

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/uu_counter/track.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path.



3
4
5
# File 'app/models/uu_counter/track.rb', line 3

def path
  @path
end

#uuidObject

Returns the value of attribute uuid.



3
4
5
# File 'app/models/uu_counter/track.rb', line 3

def uuid
  @uuid
end

Instance Method Details

#recordObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/models/uu_counter/track.rb', line 8

def record
    past_track = Track.find(uuid: self.uuid, path: self.path)
    if past_track
        return { 'status': 'Already the user accessed to the page.' }
    end
    if self.save
        return { 'status': 'The access track was successfully saved.' }
    else
        return { 'status': "The access track couldn't be saved." }
    end
end