Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

VAIRIX/relations

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

gem install relations

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

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

About

RubyOnRails Gem to relate models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.