class Topic
Attributes
after_validation_performed[RW]
approved[RW]
content[RW]
created_at[RW]
title[RW]
Public Class Methods
_validates_default_keys()
click to toggle source
Calls superclass method
# File activemodel/test/models/topic.rb, line 7 def self._validates_default_keys super | [ :message ] end
new(attributes = {})
click to toggle source
# File activemodel/test/models/topic.rb, line 16 def initialize(attributes = {}) attributes.each do |key, value| send "#{key}=", value end end
public_method()
click to toggle source
# File activerecord/test/cases/scoping/named_scoping_test.rb, line 456 def public_method; end
Protected Class Methods
protected_method()
click to toggle source
# File activerecord/test/cases/scoping/named_scoping_test.rb, line 459 def protected_method; end
Private Class Methods
private_method()
click to toggle source
# File activerecord/test/cases/scoping/named_scoping_test.rb, line 462 def private_method; end
Public Instance Methods
approved=(val)
click to toggle source
# File activerecord/test/models/topic.rb, line 73 def approved=(val) @custom_approved = val write_attribute(:approved, val) end
call()
click to toggle source
# File activerecord/test/models/topic.rb, line 26 def call klass.where(approved: true) end
condition_is_true()
click to toggle source
# File activemodel/test/models/topic.rb, line 22 def condition_is_true true end
condition_is_true_but_its_not()
click to toggle source
# File activemodel/test/models/topic.rb, line 26 def condition_is_true_but_its_not false end
my_validation()
click to toggle source
# File activemodel/test/models/topic.rb, line 34 def my_validation errors.add :title, "is missing" unless title end
my_validation_with_arg(attr)
click to toggle source
# File activemodel/test/models/topic.rb, line 38 def my_validation_with_arg(attr) errors.add attr, "is missing" unless send(attr) end
one()
click to toggle source
# File activerecord/test/models/topic.rb, line 20 def one 1 end
parent()
click to toggle source
# File activerecord/test/models/topic.rb, line 48 def parent Topic.find(parent_id) end
perform_after_validation()
click to toggle source
# File activemodel/test/models/topic.rb, line 30 def perform_after_validation self.after_validation_performed = true end
topic_id()
click to toggle source
trivial method for testing Array#to_xml
with :methods
# File activerecord/test/models/topic.rb, line 53 def topic_id id end
Private Instance Methods
after_create_for_transaction()
click to toggle source
# File activerecord/test/models/topic.rb, line 98 def after_create_for_transaction; end
after_save_for_transaction()
click to toggle source
# File activerecord/test/models/topic.rb, line 97 def after_save_for_transaction; end
before_destroy_for_transaction()
click to toggle source
# File activerecord/test/models/topic.rb, line 96 def before_destroy_for_transaction; end
before_save_for_transaction()
click to toggle source
# File activerecord/test/models/topic.rb, line 95 def before_save_for_transaction; end
before_validation_for_transaction()
click to toggle source
# File activerecord/test/models/topic.rb, line 94 def before_validation_for_transaction; end
default_written_on()
click to toggle source
# File activerecord/test/models/topic.rb, line 80 def default_written_on self.written_on = Time.now unless attribute_present?("written_on") end
destroy_children()
click to toggle source
# File activerecord/test/models/topic.rb, line 84 def destroy_children self.class.where("parent_id = #{id}").delete_all end
set_email_address()
click to toggle source
# File activerecord/test/models/topic.rb, line 88 def set_email_address unless persisted? self.author_email_address = "test@test.com" end end