Class | BigRecord::ConnectionAdapters::Column |
In: |
lib/big_record/connection_adapters/column.rb
|
Parent: | Object |
As long as a model has at least one column family set up for it, then columns (a.k.a. model attributes) can then be defined for the model.
The following is an example of a model named book.rb that has a column family called "attribute" set up for it:
class Book < BigRecord::Base column 'attribute:title', :string column :author, :string column :description, :string column :links, :string, :collection => true end
This simple model defines 4 columns of type string. An important thing to notice here is that the first column ‘attribute:title’ has the column family prepended to it. This is identical to just passing the symbol :title to the column method, and the default behaviour is to prepend the column family (attribute) automatically if one is not defined.
Furthermore, in HBase, there‘s the option of storing collections for a given column. This will return an array for the links attribute on a Book record.
COLLECTION_SEPARATOR | = | "::" |
alias | [R] | |
collection | [R] | |
default | [R] | |
name | [R] | |
primary | [RW] | |
type | [R] |
Check if the given record is empty. It‘s recursive since it can be an Embedded
Extract the collection from the hash, where the positions are the keys. Inspired from ActiveRecord::NestedAttributes.
params = { 'member' => { 'name' => 'joe', 'posts_attributes' => { '1' => { 'title' => 'Kari, the awesome Ruby documentation browser!' }, '2' => { 'title' => 'The egalitarian assumption of the modern citizen' }, 'new_67890' => { 'title' => '' } # This one matches the :reject_if proc and will not be instantiated. } }}
Returns the human name of the column name.
Column.new('sales_stage', ...).human_name #=> 'Sales stage'