abstract class Granite::Base
- Granite::Base
- Reference
- Object
Overview
Granite::Base is the base class for your model objects.
Included Modules
- Granite::Associations
- Granite::Callbacks
- Granite::Columns
- Granite::ConnectionManagement
- Granite::Migrator
- Granite::Querying
- Granite::Select
- Granite::Tables
- Granite::Transactions
- Granite::ValidationHelpers
- Granite::Validators
Extended Modules
- Granite::Columns::ClassMethods
- Granite::Integrators
- Granite::Migrator::ClassMethods
- Granite::Query::BuilderMethods
- Granite::Querying::ClassMethods
- Granite::Select
- Granite::Tables::ClassMethods
- Granite::Transactions::ClassMethods
Defined in:
granite/base.crClass Method Summary
- .adapter
-
.connection_switch_wait_period : Int32
Default value for the time a model waits before using a reader database connection for read operations all models use this value.
-
.connection_switch_wait_period=(connection_switch_wait_period : Int32)
Default value for the time a model waits before using a reader database connection for read operations all models use this value.
- .current_adapter : Granite::Adapter::Base | Nil
- .current_adapter=(current_adapter : Granite::Adapter::Base | Nil)
- .last_write_time
- .reader_adapter : Granite::Adapter::Base | Nil
- .reader_adapter=(reader_adapter : Granite::Adapter::Base | Nil)
- .schedule_adapter_switch
- .switch_to_reader_adapter
- .switch_to_writer_adapter
- .time_since_last_write
-
.update_last_write_time
This is done this way because callbacks don't work on class mthods
- .writer_adapter : Granite::Adapter::Base | Nil
- .writer_adapter=(writer_adapter : Granite::Adapter::Base | Nil)
Instance Method Summary
- #schedule_adapter_switch
- #switch_to_reader_adapter
- #switch_to_writer_adapter
- #time_since_last_write
- #update_last_write_time
Instance methods inherited from module Granite::Validators
errors
errors,
valid?
valid?
Instance methods inherited from module Granite::Transactions
destroy
destroy,
destroy!
destroy!,
save(*, validate : Bool = true, skip_timestamps : Bool = false)
save,
save!(*, validate : Bool = true, skip_timestamps : Bool = false)
save!,
set_timestamps(*, to time = Time.local(Granite.settings.default_timezone), mode = :create)
set_timestamps,
touch(*fields) : Bool
touch,
update(args, skip_timestamps : Bool = false)update(**args) update, update!(args, skip_timestamps : Bool = false)
update!(**args) update!
Instance methods inherited from module Granite::Columns
content_values : Array(Granite::Columns::Type)
content_values,
from_rs(result : DB::ResultSet) : Nil
from_rs,
primary_key_value
primary_key_value,
read_attribute(attribute_name : Symbol | String) : Type
read_attribute,
set_attributes(hash : Hash(String | Symbol, T)) : self forall T
set_attributes,
to_h
to_h
Instance methods inherited from module Granite::Callbacks
abort!(message = "Aborted at #{@_current_callback}.")
abort!
Class Method Detail
Default value for the time a model waits before using a reader database connection for read operations all models use this value. Change it to change it in all Granite::Base models.
Default value for the time a model waits before using a reader database connection for read operations all models use this value. Change it to change it in all Granite::Base models.
This is done this way because callbacks don't work on class mthods