Skip to content

Conversation

glampr
Copy link

@glampr glampr commented May 3, 2015

Allow to alias (possibly long) search fields with (shorter) descriptions.
Works like ransacker, but uses already valid search fields, instead of requiring to write Arel.
Useful for converting long search fields to shorter, to save url length for GET requests.

Usage

class User
  translates :profile_text # from globalize gem
  has_many :works

  ransacker_alias :free_text, :translations_profile_text_or_works_translations_title_or_works_translations_description
end

User.search(free_text_cont: "some_text")
# same as User.search(translations_profile_text_or_works_translations_title_or_works_translations_description_cont: "some_text")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [117/80]

@glampr
Copy link
Author

glampr commented May 3, 2015

Also mentioned in #253

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end at 16, 6 is not aligned with if at 12, 5

@jonatack
Copy link
Contributor

Thanks for the contribution. Closed by #623.

@jonatack jonatack closed this Dec 19, 2015
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.

3 participants