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

ActionController::Parameters error when using with Rails 5 #19

Closed tgmerritt closed 7 years ago

tgmerritt commented 7 years ago

I see that you have a Rails5 task on your roadmap, no update since April - is this project still developing?

I'm getting the follow error with Rails 5 rc2 using this gem. Basically following your API blog post exactly only using my own project's database:

 1) Api::V1::UsersController index returns the correct HTTP status (status: 200)
      Failure/Error: Unable to find matching line from backtrace
      TypeError:
        can't quote ActionController::Parameters
      # ./app/controllers/api/v1/users_controller.rb:7:in `index'
      # ./spec/apis/users_spec.rb:8:in `block (3 levels) in <top (required)>'
      # ./spec/rails_helper.rb:61:in `block (3 levels) in <top (required)>'
      # ./spec/rails_helper.rb:60:in `block (2 levels) in <top (required)>'

I can't really make sense of the error that well - haven't seen any like it.

The rails_helper points to:

  config.around(:each) do |example|
    DatabaseCleaner.cleaning do
      example.run
    end
  end

I guess it's possible that the error is more in DatabaseCleaner than it is in your gem, I'm just really not sure.

vasilakisfil commented 7 years ago

The project is not abandoned. At the moment I am writting Rails5 API tutorial blogpost I am almost done but I haven't added this gem yet (I am adding tests atm and working on rspec-api_helpers for jsonapi.)

I will take a look on Rails5 later this week. Until then I can't help much. Are you using jsonapi btw ?

vasilakisfil commented 7 years ago

Actually there could be an issue with ActionController::Parameters on Rails 5, you might have to first extract it in safe/unsafe hash before passing it over this gem. Look at here: http://api.rubyonrails.org/classes/ActionController/Parameters.html#method-i-to_h

vasilakisfil commented 7 years ago

@tgmerritt I didn't find any issue but I am adding tests atm in feat/tests branch just to make sure that there is no issue.

vasilakisfil commented 7 years ago

@tgmerritt I added many tests for Rails 5 and I didn't find any issue. Closing now but feel free to reopen if you still have issues.