filestack / filestack-rails

Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
223 stars 102 forks source link

undefined method `table_name' for Client:Class #168

Closed martinverdejo closed 7 years ago

martinverdejo commented 7 years ago

I recently tried to upgrade to filestack-rails 3.0. And now I am running into a model name error on rails.

> rails c
/Users/martin/.rvm/gems/ruby-2.3.1@rails-project-template/gems/apartment-1.2.0/lib/apartment/adapters/postgresql_adapter.rb:52:in `block in process_excluded_model': undefined method `table_name' for Client:Class (NoMethodError)

I read a bit on filestack-ruby and learned that it uses Client as a constant, which is also an ApplicationRecord model name in my rails app. I also read that you can configure your app to use a different client name but it looks like that option has purely to do with the JS side.

config.filestack_rails.client_name = "custom_client_name"

I'm not totally sure that this is the cause, and whether it's a real issue for filestack-rails.

staturecrane commented 7 years ago

@martinverdejo Hello, thanks for the comment. I think this ends up being an issue for both the Rails plugin and the SDK. You are right that the Client from the Ruby SDK is injected and the custom Client name is only for the Client-side File Picker. I will work to rename the Client on the Ruby SDK to something more specific, and then make any changes necessary in this plugin to facilitate that.

staturecrane commented 7 years ago

@martinverdejo I have gotten the go ahead to fix this issue. Expect an updated release very soon.

staturecrane commented 7 years ago

@martinverdejo New release (3.1.0) pulls in updated Ruby SDK with Client and Filelink classes changed to FilestackClient and FilestackFilelink. This should solve your namespace issue. Please update the Rails plugin. I am closing for now, but feel free to reopen if you have any further issues.

martinverdejo commented 7 years ago

Thanks a lot! Will update my gems soon!