ransack

https://github.com/activerecord-hackery/ransack

Ruby

Object-based searching.

Ransack::Nodes::Condition#build_attribute

== build_attribute

 This method was originally called from Nodes::Grouping#new_condition
 only, without arguments, without #valid? checking, to build a new
 grouping condition.

 After refactoring in 235eae3, it is now called from 2 places:

 1. Nodes::Condition#attributes=, with +name+ argument passed or +name+
    and +ransacker_args+. Attributes are included only if #valid?.

 2. Nodes::Grouping#new_condition without arguments. In this case, the
    #valid? conditional needs to be bypassed, otherwise nothing is
    built. The `name.nil?` conditional below currently does this.

 TODO: Add test coverage for this behavior and ensure that `name.nil?`
 isn't fixing issue #701 by introducing untested regressions.

Source | Google | Stack overflow

Edit

git clone [email protected]:activerecord-hackery/ransack.git

cd ransack

open lib/ransack/nodes/condition.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Ransack--Nodes--Condition-build_attribute-for-pr


# Commit to git

git add lib/ransack/nodes/condition.rbgit commit -m "better docs for Ransack::Nodes::Condition#build_attribute"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Ransack--Nodes--Condition-build_attribute-for-pr

hub pull-request


# Celebrate!