oddcamp / active_hash_relation

ActiveHash Relation: Simple gem that allows you to run multiple ActiveRecord::Relation using hash. Perfect for APIs.
https://www.kollegorna.se/
MIT License
118 stars 15 forks source link

add null filter support #16

Closed maceonrails closed 8 years ago

maceonrails commented 8 years ago

usage { field: { null: true } } for is null filter and { field: { null: false } } for not null filter

vasilakisfil commented 8 years ago

Hi! Thanks for the PR. Could you update the readme and show how it works :)

maceonrails commented 8 years ago

Hi, I've update the readme file. thanks :)

vasilakisfil commented 8 years ago

I can see you check params[:null] == true. Will that always work ? I would use ActiveRecord::Type::Boolean.new.type_cast_from_database to be sure that all 't', '1', 1, 'true', 'TRUE' and boolean true work :)

I can fix it later tonight once I merge no worries :)

maceonrails commented 8 years ago

yea i have test it and it work both for true and false value, but if you think it better to use type cast to make sure it work, thats good :)

vasilakisfil commented 8 years ago

@maceonrails it seems good! I thought I could branch in your branch but it's a pull request from another repo so it's impossible :)

Can you add ActiveRecord::Type::Boolean.new.type_cast_from_database in your code and squash your commits to 1 commit ? Then I will merge instantly :)

vasilakisfil commented 8 years ago

Not sure how I missed that, merged :)