Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added includes method to enable explicit join with associated tables #1927

Closed
wants to merge 1 commit into from

Conversation

yangchenyun
Copy link
Contributor

added includes(*join_tables) to include the associated tables explicitly because references doesn't know whether the associated tables are being loaded.

otherwise, a ERROR will be thrown for undefined tables. For example

class Person
    has_many :phone_numbers

   rails_admin do
     configure :phone_numbers, :has_many_association
     list do
      field :phone_numbers do
        searchable ['phone_numbers.number']
      end
     end
   end
end

will throw an error

`SELECT  "people".* FROM "people"  WHERE ((LOWER(phone_numbers.location) ILIKE '%13%'))  ORDER BY people.id desc LIMIT 20 OFFSET 0`

@yangchenyun
Copy link
Contributor Author

#1437 #1925

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 2928289 on yangchenyun:master into * on sferik:master*.

@yangchenyun
Copy link
Contributor Author

@mshibuya Help me have a review on that? This fixes the issues #1925 I had before.

@yangchenyun yangchenyun closed this Mar 7, 2014
@yangchenyun yangchenyun reopened this Mar 7, 2014
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling fffbebd on yangchenyun:master into 48686de on sferik:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling fffbebd on yangchenyun:master into 48686de on sferik:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling fffbebd on yangchenyun:master into 48686de on sferik:master.

@yangchenyun
Copy link
Contributor Author

The above code breaks on the belongs_to behavior.

@yangchenyun yangchenyun closed this Mar 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants