vendredi 26 juin 2015

Rails Joins inherited relation

I have a relation with

MODEL USER

has_one :user_information
has_many :user_tags

MODEL USER_INFORMATION

BELONGS_TO :user

AND HAVE A MODEL

USER_TAG

belongs_to :user

question:

How to acess a ORDER BY USER_INFORMATION IS NOT NULL FROM USER_HAST_TAG with joins

NEED:

@USER_TAGS=UserTag.joins(:user).where(:active => true).order("user.user_information is not null desc")

Im Try with

@USER_TAGS=UserTag.joins(:user,{:usuario => :usuario_videos}).where(:active => true).order("user.user_information is not null desc")

ouput mysql Unknown column user.user_information

thanks for you help

Aucun commentaire:

Enregistrer un commentaire