To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / test / exemplars / message_exemplar.rb @ 441:cbce1fd3b1b7
History | View | Annotate | Download (467 Bytes)
| 1 |
class Message < ActiveRecord::Base |
|---|---|
| 2 |
generator_for :subject, :method => :next_subject |
| 3 |
generator_for :content, :method => :next_content |
| 4 |
generator_for :board, :method => :generate_board |
| 5 |
|
| 6 |
def self.next_subject |
| 7 |
@last_subject ||= 'A Message' |
| 8 |
@last_subject.succ!
|
| 9 |
@last_subject
|
| 10 |
end
|
| 11 |
|
| 12 |
def self.next_content |
| 13 |
@last_content ||= 'Some content here' |
| 14 |
@last_content.succ!
|
| 15 |
@last_content
|
| 16 |
end
|
| 17 |
|
| 18 |
def self.generate_board |
| 19 |
Board.generate!
|
| 20 |
end
|
| 21 |
end
|