Class: Prayer

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps::Created
Defined in:
app/models/prayer.rb

Overview

The Email model stores an entry for each user's email address. Email addresses are stored here to give us an entry to associate prayer requests with.

Author:

  • Robert Klubenspies

Since:

  • 0.1.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.feed(last) ⇒ Array

Finds up to 10 prayer requests in descending order that are older than a given timestamp

Author:

  • Robert Klubenspies

Since:

  • 0.1.0


44
45
46
# File 'app/models/prayer.rb', line 44

def self.feed(last)
  self.all.where(:created_at.lt => last).desc(:created_at).limit(10).entries
end

Instance Method Details

#ip_addressString

Returns ip_address the IP address from which the prayer request was posted

Since:

  • 0.1.0


17
# File 'app/models/prayer.rb', line 17

field :ip_address, type: String

#locationString

Returns location the plain-English location (city, state, country, etc.) that a request was posted with

Since:

  • 0.1.0


26
# File 'app/models/prayer.rb', line 26

field :location, type: String

#nameString

Returns name the author name to be displayed with the prayer request

Since:

  • 0.1.0


11
# File 'app/models/prayer.rb', line 11

field :name, type: String

#reportedInteger

Returns reported the number of times that the prayer request was reported

Since:

  • 0.1.0


23
# File 'app/models/prayer.rb', line 23

field :reported, type: Integer, default: 0

#requestString

Returns request the full text of the prayer request

Since:

  • 0.1.0


14
# File 'app/models/prayer.rb', line 14

field :request, type: String

#times_prayed_forInteger

Returns time_prayed_for the number of times that the prayer request was prayed for

Since:

  • 0.1.0


20
# File 'app/models/prayer.rb', line 20

field :times_prayed_for, type: Integer, default: 0