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

Add support for alias_attribute #589

Closed
ghost opened this issue Sep 17, 2015 · 1 comment
Closed

Add support for alias_attribute #589

ghost opened this issue Sep 17, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 17, 2015

For example, I'm working on top of a legacy database which has all it's column names in german. I use alias_attritbute to map english names to the german column names. If I were to use Ransack I would have to support using the german attributes as query params.

With this example:

class Location < ActiveRecord::Base
  self.table_name = 'orte'
  alias_attribute :code, :bezeichnung
end

The request /api/locations?q[code_eq]=bremen will not work. As it will construct the query as where orte.code = 'bremen', while it should be translated to where orte.bezeichnung = 'bremen' .

@jonatack
Copy link
Contributor

Hello @martndemus, thank you for highlighting this. It seems like an edge case feature request rather than a bug with the current code. I do not plan to work on it, but encourage you to make a pull request it if it is worthwhile for you to add it to Ransack. Cheers!

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

No branches or pull requests

1 participant