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

Fix #tables deprecation in Rails 5.0 - Fixes #933 #943

Merged
merged 1 commit into from
Apr 23, 2017

Conversation

guialbuk
Copy link
Collaborator

And keep compatibility with Rails 4.x

@@ -38,7 +38,9 @@ def join_table_option_correct?
end

def join_table_exists?
if connection.tables.include?(join_table_name)
if (connection.respond_to?(:data_sources) ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid multi-line ?: (the ternary operator); use if/unless instead.
Don't use parentheses around the condition of an if.

@guialbuk
Copy link
Collaborator Author

Fixes #933

@@ -37,8 +37,16 @@ def join_table_option_correct?
end
end

def tables_and_views(table_or_view)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about having this method return connection.data_sources or connection.tables instead of a boolean? Also, let's put this in RailsShim -- we have a collection of methods there that deal with compatibility between Rails versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcmire Good idea. I will make the changes.

@guialbuk
Copy link
Collaborator Author

@mcmire Do you think the code is better now? I'm opened to any feedback.

@mcmire
Copy link
Collaborator

mcmire commented Jul 21, 2016

Sorry for the delay. Yup, I think this is good! Do you mind squashing your commits? I'll merge it in after you do that.

@petercm
Copy link

petercm commented Aug 12, 2016

@mcmire Can this get merged? Lot of noise from these messages. Thanks!

@mcmire mcmire mentioned this pull request Sep 4, 2016
9 tasks
@kwigginton
Copy link

@mcmire can you please merge this? seconding petercm's comment

@alejandroperea
Copy link

It would be nice to merge this to avoid Rails 5 deprecation warnings.

@jkepps
Copy link

jkepps commented Feb 17, 2017

@mcmire 4thing the above comments

@mikemerritt
Copy link

@mcmire Any chance of getting this merged soon?

@guialbuk
Copy link
Collaborator Author

@mikemerritt I'm setting up the Travis CI environment for Rails 5.0 so we can merge it safely.

@guialbuk guialbuk changed the base branch from master to rails-5 April 23, 2017 20:40
@guialbuk guialbuk merged commit 7239d1f into thoughtbot:rails-5 Apr 23, 2017
@guialbuk guialbuk deleted the fix-933 branch April 23, 2017 21:30
@guialbuk
Copy link
Collaborator Author

Fixes #933

guialbuk pushed a commit to guialbuk/shoulda-matchers that referenced this pull request Jul 5, 2017
… to 5.0.4 and 4.2.9 in Appraisal Add missing json dependency for rdoc in Rails 4.1 and 4.2 failing in TravisCI Merge pull request thoughtbot#1015 from thoughtbot/master 2 months ago Merge pull request thoughtbot#1014 from guialbuk/rails-5-readme Add installation instructions for Rails 5.0 Merge pull request thoughtbot#943 from guialbuk/fix-933 Fix #tables deprecation in Rails 5.0 and keep compatibility with Rails 4.x Merge pull request thoughtbot#1013 from guialbuk/travis-rails-5 Fix multi-line block code style Add jbuilder to rails 4.2 and 5.0 tests Update appraisal to rails 5.0.2 Add rails-controller-testing gem to rails 5.0 tests Fetch pry gem using HTTPS Don't protect attributes under Rails 5 Don't require ActiveResource tests under Rails 5 capture, silence_stream, and silence_stderr were removed in Rails 5 Exclude Ruby 2.3 from Rails 4.0.x jobs in Travis CI Add specific ruby versions so Travis CI downloads the right rvm binaries Exclude Ruby 2.0 and 2.1 from Rails 5.0 jobs in Travis CI Update Rails versions to 5.0.4 and 4.2.9 in Appraisal
tjgrathwell pushed a commit to railsbridge/bridge_troll that referenced this pull request Jul 19, 2017
…ning

See issue here: thoughtbot/shoulda-matchers#933
See fix here: thoughtbot/shoulda-matchers#943
DEPRECATION WARNING: #tables currently returns both tables and views. This behavior is deprecated and will be changed with Rails 5.1 to only return tables. Use #data_sources instead.
@guialbuk guialbuk added this to the v4.0 milestone Jul 31, 2017
Hamled pushed a commit to AdaGold/rails-debugging that referenced this pull request Apr 23, 2018
…ning

See issue here: thoughtbot/shoulda-matchers#933
See fix here: thoughtbot/shoulda-matchers#943
DEPRECATION WARNING: #tables currently returns both tables and views. This behavior is deprecated and will be changed with Rails 5.1 to only return tables. Use #data_sources instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants