Project

further

0.0
No commit activity in last 3 years
No release in over 3 years
This gem provides a simple and extremely flexible way to add extra data into your models without adding new column for that.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.2.13
 Project Readme

further Gem Version

This gem provides a simple and extremely flexible way to add extra data into your models without adding new column for that.

Installation

Install the latest stable release:

[sudo] gem install further

In Rails, add it to your Gemfile:

gem 'further'

Finally, restart the server to apply the changes.

Note that further is work in Rails 3+ and Ruby 1.9+

Getting Started

Start off by generating an uploader:

rails generate further model

This should give you further_information model and the migrate file.

app/models/further_information.rb
db/migrates/%timestamp%_create_further_information.rb

Then rake db:migrate

rake db:migrate

Open your model file that you want to use further with:

class Site < ActiveRecord::Base
  # you can choose any name
  further :info
end

Open the other model that you want to use further too:

class IP < ActiveRecord::Base
  further :data
end

Now you can add extra data in Site and IP model

s = Site.create info: {alexa_rank: 41253, last_updated: DateTime.now}
s.info[:alexa_rank]  # => 41253
 # you can add more info after you create the object
s.info page_rank: 3
s.info[:page_rank]  # => 3
s.info  # => {:alexa_rank=>41253, :last_updated=>Mon, 25 Nov 2013 18:43:22 +0300, :page_rank=>3}

IP.first.data # => {}
IP.first.data last_check: DateTime.now
# => {:last_check=>Mon, 25 Nov 2013 18:44:13 +0300 }