0.0
No commit activity in last 3 years
No release in over 3 years
Create virtual attributes for active record. Uses serialization
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

<= 5.0, >= 3.0
 Project Readme

V(irtual)attributes

Makes virtual attributes easier.

Build Status Coverage Status Code Climate Dependency Status Gem Version

Instalation

Add this line to your application's Gemfile:

gem 'vattributes'

And then execute:

$ bundle

Usage

Add the vattributes field to the table as a text and run the migration:

rails g migration AddVattributesToPosts vattributes:text
rake db:migrate
class Post < ActiveRecord::Base
  vattributes :permalink

  validates :permalink, presence: true
end

If you ever need to overrite a setter, or getter, you can do like follows:

class Post < ActiveRecord::Base
  vattributes :tags, :permalink

  def tags=(array)
    set_vattribute(:tags, array.join(','))
  end

  def tags
    get_vattribute(:tags).split(',')
  end
end

Authors

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

** Do not forget to write tests**