Skip to content

Allows a Rails application to store and manage incomplete date data.

License

Notifications You must be signed in to change notification settings

ErCollao/incomplete_date

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

incomplete_date

This plugin allows a Rails application to store and manage incomplete date data, which is very common in historical archives, particularly in genealogy.

Usage

Declare columns in the database, preferably with the expected attribute name prefixed, for instance with ‘raw_’. For example, for an attribute named birth_date we could declare a column named raw_birth_date or alternatively internal_birth_date. The type of these columns must be :integer.

Then in the models, to have the virtual attributes returning and accepting values of type IncompleteDate declare the following:

incomplete_date_attrs :birth_date, :death_date, :prefix => 'raw'

The default prefix is ‘raw’ so we do not need to declare it, unless we used another prefix for the columns.

Alternatively, if there’s no regular relation between the column name and the expected attribute name, use the following way:

incomplete_date_attr :attr_name, :raw_column_name

Note that in this last example we used the singular method call (finished in attr instead of attrs). In this case we pass the attribute name we want, followed by the real column name found in the database.

Installation

From your rails app directory do the following:

./script/plugin install git:https://github.com/gnapse/incomplete_date.git

Alternatively, if you are tracking your own project with git and you want to have this plugin as a git submodule, instead of redundantly tracking this plugin’s source code in your own repo, you can install it this way instead:

git submodule add git:https://github.com/gnapse/incomplete_date.git vendor/plugins/incomplete_date/

Contributing

If you want to contribute to (or fork) this project you can clone it by doing the following:

git clone add git:https://github.com/gnapse/incomplete_date.git

And then send pull requests.

License

Released under the MIT license.

Authors

About

Allows a Rails application to store and manage incomplete date data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%