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

breaking change 3.5.1, simple_form stopped working with PORO, doesn't call methods anymore #1563

Closed
srghma opened this issue Mar 30, 2018 · 2 comments

Comments

@srghma
Copy link

srghma commented Mar 30, 2018

Environment

  • Ruby [2.4.2]
  • Rails [5.1.5]
  • Simple Form [3.5.1]

Current behavior

Im using delegator

  class UserDecorator < SimpleDelegator
    include ActionView::Helpers::FormOptionsHelper

    def initialize(user, form: nil)
      @form = form
      super user
    end

    def first_name
      require 'pry'; ::Kernel.binding.pry;
      @form&.first_name || __getobj__.first_name
    end
  end
      @user = PhysicalCheckoutPage::UserDecorator.new(
        current_user || User.new,
        form: form
      )
      - presenter.user.first_name

      = simple_form_for(presenter.user,
        as: :user,
        url: physical_checkout_path(presenter.book),
        html: { method: :put, class: 'px-5', id: 'physical-checkout-form' }) do |f|

        = f.input :first_name,
          wrapper_html: { class: 'row' },
          input_html: { required: true, class: 'form-control form-control-sm' },
          label_html: { class: 'h5 custom-dark-grey col-form-label' }

in simpleform 3.5.1 first_name called only once, in 3.5.0 - twice

Expected behavior

call twice

@srghma srghma changed the title breaking change 3.5.1, simple_form stopped working with PORO breaking change 3.5.1, simple_form stopped working with PORO, doesn't call methods anymore Mar 30, 2018
@feliperenan
Copy link
Collaborator

@srghma It seems like the same than #1549.

We have included documentation about it, maybe it can help you.

@srghma
Copy link
Author

srghma commented Apr 2, 2018

ok, understand, tnx

@srghma srghma closed this as completed Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants