weixin_39814378
2021-01-12 13:53 阅读 1

We trigger our own deprecation notice

Copied from a comment by in #1063:

It looks like this also prints out deprecation warnings for normal usage. InputHelper#input still calls input_class internally, so this logs a warning that users of the gem can't really fix.

are you able to take a look a this please?

该提问来源于开源项目:formtastic/formtastic

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

11条回答 默认 最新

  • weixin_39598941 weixin_39598941 2021-01-12 13:53

    Thanks . We're still looking into this on our end, too.

    It looks like adding this line to the initializer suppresses the message: https://github.com/justinfrench/formtastic/blob/master/lib/generators/templates/formtastic.rb#L96

     ruby
    Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
    

    So maybe the best approach is to either mention that in the deprecation message, or issue a separate warning if that's undefined. It would be helpful to have an upgrade guide in the README, too. Happy to help out, but I'm not sure what else would need to be in there. Is it best to re-run rails generate formtastic:install on each upgrade?

    点赞 评论 复制链接分享
  • weixin_39598941 weixin_39598941 2021-01-12 13:53

    I just ran across https://github.com/justinfrench/formtastic/wiki/Upgrading-to-Formtastic-3.1 but it looks like it was forgotten :smile:

    点赞 评论 复制链接分享
  • weixin_39552179 weixin_39552179 2021-01-12 13:53

    yes, it calls input_class internally, to keep the backwards compatibility but then it uses the namespaces if configured https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/helpers/input_helper.rb#L339

    the deprecation warning can be fixed by configuring them in the initializer, i'll write the upgrade guide within 24 hours, then you could release a point version which has a link in the deprecation notice?

    点赞 评论 复制链接分享
  • weixin_39814378 weixin_39814378 2021-01-12 13:53

    That'd be awesome, thanks

    点赞 评论 复制链接分享
  • weixin_39552179 weixin_39552179 2021-01-12 13:53

    Updated the wiki : https://github.com/justinfrench/formtastic/wiki/Upgrading-to-Formtastic-3.1 please check and correct/report if there are any mistakes.

    I'll create a PR tuning the RDoc, because it is not rendered correctly: http://www.rubydoc.info/gems/formtastic/Formtastic/NamespacedClassFinder

    could you check that the updated wiki would be enough for you to solve the issue? (if the deprecation notice would link to it of course)

    点赞 评论 复制链接分享
  • weixin_39814378 weixin_39814378 2021-01-12 13:53

    Thanks , so the TODO from here is… - [x] update wiki - [x] review wiki - [x] to confirm the wiki solves his problem - [x] to tune RDoc for NamespacedClassFinder - [x] to update deprecation notice to reference wiki page - [x] to build & ship 3.1.1

    点赞 评论 复制链接分享
  • weixin_39598941 weixin_39598941 2021-01-12 13:53

    Thanks, & . That wiki page looks great (I just fixed one minor typo in it).

    I can confirm that after regenerating the initializer, we haven't seen the deprecation message again, and we haven't noticed any other upgrade problems either.

    点赞 评论 复制链接分享
  • weixin_39814378 weixin_39814378 2021-01-12 13:53

    Thanks

    点赞 评论 复制链接分享
  • weixin_39552179 weixin_39552179 2021-01-12 13:53

    Updated docs in #1101

    点赞 评论 复制链接分享
  • weixin_39552179 weixin_39552179 2021-01-12 13:53

    Added link in #1102 and updated wiki to point to master branch documentation.

    点赞 评论 复制链接分享
  • weixin_39814378 weixin_39814378 2021-01-12 13:53

    3.1.1 has been shipped, thanks and , closing

    点赞 评论 复制链接分享

相关推荐