Home

Awesome

Gem Version Build Status Coverage Status

SchemaPlus::Columns

SchemaPlus::Columns adds some useful accessors the objects returned by ActiveRecord's Model.columns database introspection query.

SchemaPlus::Columns is part of the SchemaPlus family of Ruby on Rails extension gems.

Installation

<!-- SCHEMA_DEV: TEMPLATE INSTALLATION - begin --> <!-- These lines are auto-inserted from a schema_dev template -->

As usual:

gem "schema_plus_columns"                # in a Gemfile
gem.add_dependency "schema_plus_columns" # in a .gemspec
<!-- SCHEMA_DEV: TEMPLATE INSTALLATION - end -->

Usage

SchemaPlus::Columns makes these accessors available:

column.indexes

Returns a list of index definitions for each index that refers to this column. Returns an empty list if there are no such indexes.

column.unique?

Returns true if the column is in a unique index.

column.unique_scope

If the column is in a unique index, returns a list of names of other columns in the index. Returns an empty list if it's a single-column index. Returns nil if the column is not in a unique index.

column.case_sensitive?

Returns true if the column is in one or more indexes that are case sensitive. Requires the index definitions to respond to :case_sensitive? -- i.e. Only works with schema_plus_pg_indexes having been loaded.

column.required_on

Returns an indicator of the circumstance in which the column must have a value:

Compatibility

SchemaPlus::Columns is tested on:

<!-- SCHEMA_DEV: MATRIX - begin --> <!-- These lines are auto-generated by schema_dev based on schema_dev.yml --> <!-- SCHEMA_DEV: MATRIX - end -->

Release Notes

Development & Testing

Are you interested in contributing to SchemaPlus::Columns? Thanks! Please follow the standard protocol: fork, feature branch, develop, push, and issue pull request.

Some things to know about to help you develop and test:

<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - begin --> <!-- These lines are auto-inserted from a schema_dev template --> <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end --> <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - begin --> <!-- These lines are auto-inserted from a schema_dev template --> <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - end --> <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_MONKEY - begin --> <!-- These lines are auto-inserted from a schema_dev template --> <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_MONKEY - end -->