Skip to content

Conversation

allenwq
Copy link
Contributor

@allenwq allenwq commented Aug 29, 2016

  • Support simple_form 3.3

Simple form updated their find_attribute_column in 3.3, sql_type is not work anymore.

def find_attribute_column(attribute_name)
  if @object.respond_to?(:type_for_attribute) && @object.has_attribute?(attribute_name)
    @object.type_for_attribute(attribute_name)
  elsif @object.respond_to?(:column_for_attribute) && @object.has_attribute?(attribute_name)
    @object.column_for_attribute(attribute_name)
  end
end

Actually, I don't know why sql_type is used before, @lowjoel Any comments ?

@allenwq
Copy link
Contributor Author

allenwq commented Aug 29, 2016

@lowjoel Think all specs cannot run after rails or rspec update, something to do with the spec setup, can you help with that ?

@lowjoel
Copy link
Owner

lowjoel commented Aug 29, 2016

@allenwq rebase on master.

This is because the Types API is only introduced in Rails 4.2. You'd need to check for the proper attribute and used that instead.

* Support simple_form 3.3
@allenwq
Copy link
Contributor Author

allenwq commented Aug 30, 2016

@lowjoel Thanks ! Updated and slightly modified the specs.

@lowjoel
Copy link
Owner

lowjoel commented Aug 30, 2016

If there are only 2 alternatives, maybe both should be tested as separate contexts?

@allenwq
Copy link
Contributor Author

allenwq commented Aug 30, 2016

I have thought about that, it will duplicate the entire file and testing the same thing... finally I chose to use sample. What do you think ?

@lowjoel
Copy link
Owner

lowjoel commented Aug 31, 2016

[:type, :sql_type].each do |method|
  # specs here
end

@allenwq
Copy link
Contributor Author

allenwq commented Aug 31, 2016

Not that simple because DateTimeModel need to call the right method type or sql_type.

Think I have a way, will update first.

@allenwq
Copy link
Contributor Author

allenwq commented Sep 1, 2016

@lowjoel Updated

@allenwq
Copy link
Contributor Author

allenwq commented Sep 2, 2016

@lowjoel Any comments ?

@lowjoel
Copy link
Owner

lowjoel commented Sep 3, 2016

Looks good.

@lowjoel lowjoel merged commit 7869130 into lowjoel:master Sep 3, 2016
@allenwq
Copy link
Contributor Author

allenwq commented Sep 3, 2016

@lowjoel Thanks ! Can release a new version ?

@lowjoel
Copy link
Owner

lowjoel commented Sep 10, 2016

Released.

@allenwq
Copy link
Contributor Author

allenwq commented Sep 10, 2016

Thanks !

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