Alias for relationship

I have this:

  class User < ActiveRecord::Base     has_many :jobs 

How can I rename ":jobs" to something else without renaming the source class? I just want to be to refer to them as:

  class User < ActiveRecord::Base     has_many :obligations 

and that's it. I've tried:

has_many :obligations, source: :user 

but it didn't work.


Category: ruby on rails Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.165 (s). 12 q(s)