... | @@ -116,11 +116,13 @@ list.second # nil |
... | @@ -116,11 +116,13 @@ list.second # nil |
|
list.third # nil
|
|
list.third # nil
|
|
```
|
|
```
|
|
|
|
|
|
#### Returning the records' type
|
|
#### ~~Returning the records' type~~
|
|
|
|
|
|
In order to perform any query with correct performance and maintainability, this feature uses [Auxiliary Statements](https://github.com/crashtech/torque-postgresql/wiki/Auxiliary-Statements) and [Dynamic Attributes](https://github.com/crashtech/torque-postgresql/wiki/Dynamic-Attributes).
|
|
> DEPRECATED: This is being replaced by a cast operation that translates the tableoid into its table name (AKA regclass), as in `"activities"."tableoid"::regclass`. This improvement removes the necessity of an auxiliary statement and an extra join in queries.
|
|
|
|
|
|
The `_record_class` (with can be renamed using the [`inheritance.record_class_column_name`](https://github.com/crashtech/torque-postgresql/wiki/Configuring#inheritance.record_class_column_name) setting) is used both as an Auxiliary Statement and a Dynamic Attribute to get the type of the records. While it's a great example of these provided features, you can always take advantage of this to get the type of the record.
|
|
~~In order to perform any query with correct performance and maintainability, this feature uses [Auxiliary Statements](https://github.com/crashtech/torque-postgresql/wiki/Auxiliary-Statements) and [Dynamic Attributes](https://github.com/crashtech/torque-postgresql/wiki/Dynamic-Attributes).~~
|
|
|
|
|
|
|
|
The `_record_class` method (which can be renamed using the [`inheritance.record_class_column_name`](https://github.com/crashtech/torque-postgresql/wiki/Configuring#inheritance.record_class_column_name) setting) is used both as an Auxiliary Statement and a Dynamic Attribute to get the type of the records. While it's a great example of these provided features, you can always take advantage of this to get the type of the record.
|
|
|
|
|
|
```ruby
|
|
```ruby
|
|
list = Activity.all.with(:_record_class).load.to_a
|
|
list = Activity.all.with(:_record_class).load.to_a
|
... | | ... | |