Project

relations

0.0
No commit activity in last 3 years
No release in over 3 years
Relations generator solution for Rails
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 3.0.0
 Project Readme

Relations¶ ↑

Relations is a gem to generate associations between models in a Rails application. With a simple command you can generate the migration and add the associations to the models involved.

Installation¶ ↑

You can use relations gem with any rails version major to 3.0:

gem install relations

Usage ¶ ↑

After you install Relations and add it to your Gemfile, you could use it in the following way:

rails generate relation model_one relation_type model_two
  • Both models should be created before you can generate the relation.

  • Both model’s names should be in the singular form.

  • Sopported Relations types:

has_many
belongs_to
has_one
has_and_belongs_to_many

For instance:

rails g relation user has_many task

It should:

* generate a migration “db/migration/***_relate_users_to_tasks.rb”

* add “has_many :tasks” line to app/models/user.rb

* add “belongs_to :user” line to app/models/task.rb

Maintainers¶ ↑

License¶ ↑

MIT License. Copyright 2011 VAIRIX Software Development. www.vairix.com