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.

Replay

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

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

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