Class: DiscourseDev::Tag
Constant Summary
Constants inherited from Record
Record::AUTO_POPULATED, Record::DEFAULT_COUNT
Instance Attribute Summary
Attributes inherited from Record
Instance Method Summary collapse
- #create! ⇒ Object
- #data ⇒ Object
-
#initialize ⇒ Tag
constructor
A new instance of Tag.
- #populate! ⇒ Object
Methods inherited from Record
#current_count, populate!, random
Constructor Details
#initialize ⇒ Tag
Returns a new instance of Tag.
9 10 11 |
# File 'lib/discourse_dev/tag.rb', line 9 def initialize super(::Tag, DiscourseDev.config.tag[:count]) end |
Instance Method Details
#create! ⇒ Object
13 14 15 16 17 18 |
# File 'lib/discourse_dev/tag.rb', line 13 def create! super rescue ActiveRecord::RecordInvalid => e # If the name is taken, try again retry end |
#data ⇒ Object
25 26 27 |
# File 'lib/discourse_dev/tag.rb', line 25 def data { name: Faker::Discourse.unique.tag } end |
#populate! ⇒ Object
20 21 22 23 |
# File 'lib/discourse_dev/tag.rb', line 20 def populate! return unless SiteSetting.tagging_enabled super end |