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

Fixed returned value of Ransack::Nodes::Condition#format_predicate #692

Merged
merged 1 commit into from
Jul 23, 2016
Merged

Fixed returned value of Ransack::Nodes::Condition#format_predicate #692

merged 1 commit into from
Jul 23, 2016

Conversation

camelmasa
Copy link
Contributor

@camelmasa camelmasa commented Jul 1, 2016

I tried to change spec/support/schema.rb and spec/ransack/adapters/active_record/base_spec.rb like below.

# spec/support/schema.rb:69
ransacker :array_users,                                                                                                
  formatter: proc { |v| Person.where(id: v).map(&:id) } do |parent|                                                    
  parent.table[:id]                                                                                                    
end   
# spec/ransack/adapters/active_record/base_spec.rb:316
it 'should function correctly when passing an array of ids' do                                                           
  s = Person.ransack(array_users_in: [1, 2])                                                                               
  expect(s.result.count).to be 2
end

Should be pass tests but that couldn't pass tests.

Because, Ransack::Nodes::Condition#format_predicate method can target predicate.right[0] only.
I think the method should target several predicate.right.

@camelmasa camelmasa changed the title Fix value when several predicate.right Fix returned value when several predicate.right Jul 1, 2016
@camelmasa
Copy link
Contributor Author

camelmasa commented Jul 22, 2016

@jonatack Could you review when you have chance ❓

I want to add some informations if that was not enough. Thanks.

@jonatack jonatack merged commit 2b2bd1d into activerecord-hackery:master Jul 23, 2016
@jonatack
Copy link
Contributor

Thank you @camelmasa, tested it, LGTM.
❤️ 💚 💙 💛 💜

@jonatack
Copy link
Contributor

Feel free to add a change log PR.

jonatack added a commit that referenced this pull request Jul 23, 2016
@camelmasa
Copy link
Contributor Author

@jonatack Thank you very much for merged this PR 🤗

Yeah, I'm going to add change log next week 👍

@camelmasa camelmasa deleted the fix-ransack-condition branch July 23, 2016 12:44
@camelmasa camelmasa changed the title Fix returned value when several predicate.right Fixed returned value of Ransack::Nodes::Condition#format_predicate Jul 25, 2016
@camelmasa camelmasa changed the title Fixed returned value of Ransack::Nodes::Condition#format_predicate Fixed returned value of Ransack::Nodes::Condition#format_predicate Jul 25, 2016
@camelmasa camelmasa mentioned this pull request Jul 25, 2016
jonatack added a commit that referenced this pull request Jul 25, 2016
prasadsurase pushed a commit to prasadsurase/ransack that referenced this pull request Sep 22, 2016
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.

2 participants