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: undefined method column_types #1

Merged
merged 1 commit into from
May 12, 2016

Conversation

mklbtz
Copy link

@mklbtz mklbtz commented May 12, 2016

Using this gem with rails 5.0.0.beta4, I received the error: undefined method ' column_types' when running the administrate:install task. The error originated from DashboardGenerator#column_type_for_attribute. The receiver of the call to column_types was an instance of ConnectionAdapters::Column, which has apparently never implemented that method.

Anyway, I replaced it with a call to columns_hash. I also return nil if no column matching the attribute exists. This is needed to support relationship attributes.

klass.column_types[attr].type
column = klass.columns_hash[attr]
return if column.nil?
column.type
Copy link
Owner

@BenMorganIO BenMorganIO May 12, 2016

Choose a reason for hiding this comment

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

Just nit-picking, but you could do this in two line :trollface::

column = klass.colums_hash[attr]
column.type unless column.nil?
# or
column&.type # too bad this can't be used :(
# or
column.try! :type

@BenMorganIO
Copy link
Owner

BenMorganIO commented May 12, 2016

👍 on this. Left a troll comment, but other than that this is great. How do you feel about pointing this to the thoughtbot/administrate repo?

I did take a lot of passion in making a Rails 5 supportable Administrate, but it was apparent that while I was modifying their test suite, the PRs took a lot of energy and annoyance to get merged. Are you also having this issue?

Merging, however I'd love to hear your thoughts and problems with Rails 5 support :)

@BenMorganIO BenMorganIO merged commit 36148a7 into BenMorganIO:rails-5-support May 12, 2016
@mklbtz
Copy link
Author

mklbtz commented May 13, 2016

Honestly, we might have to wait a while before Administrate can fully support Rails 5.

This was actually my first time using Administrate, but still this bug was pretty easy to fix. However, once it was fixed, loading up a dashboard view in my app led to more crashes within ActiveSupport of all things, triggered by Administrates templates. I did some research, and tried a few things but quickly landed myself in dependency hell. So, in the end I was unable to use Administrate for my project.

From that experience, it seems like the gems that Administrate depends on haven't been updated yet either. Like everyone's holding their breath for Rails 5 release candidate. Specifically, Kaminari seemed to be broken in untenable ways and its 1.0 release is still in alpha. Once I hit the Kaminari bug, I gave up.

Regarding PRs, I haven't attempted to get any merged, so I can't speak to that.

@BenMorganIO
Copy link
Owner

@mklbtz thanks for the response :). Was great to read through.

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