module
CQL::ActiveRecord::Attributes
Defined in:
active_record/attributes.crInstance Method Summary
-
#attributes(attrs : Hash(Symbol, DB::Any))
Set the record's attributes from a hash - @param attrs [Hash(Symbol, DB::Any)] The attributes to set - @return [Nil]
-
#attributes
Define instance-level methods for querying and manipulating data Fetch the record's ID or raise an error if it's nil - @return [PrimaryKey] The ID
-
#attributes(**attrs)
Set the record's attributes from a hash - @param attrs [Hash(Symbol, DB::Any)] The attributes to set - @return [Nil]
Instance Method Detail
def attributes(attrs : Hash(Symbol, DB::Any))
#
Set the record's attributes from a hash
- @param attrs [Hash(Symbol, DB::Any)] The attributes to set
- @return [Nil]
Example Setting the record's attributes
user.attributes = {name: "Alice", email: "[email protected]"}
def attributes
#
Define instance-level methods for querying and manipulating data Fetch the record's ID or raise an error if it's nil
- @return [PrimaryKey] The ID
Example Fetching the record's attributes
user.attributes
-> { id: 1, name: "Alice", email: " [email protected]" }
def attributes(**attrs)
#
Set the record's attributes from a hash
- @param attrs [Hash(Symbol, DB::Any)] The attributes to set
- @return [Nil]
Example Setting the record's attributes
user.attributes(name: "Alice", email: "[email protected]")