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

Forms sometimes become empty #1230

Closed
hron84 opened this issue Apr 13, 2012 · 8 comments
Closed

Forms sometimes become empty #1230

hron84 opened this issue Apr 13, 2012 · 8 comments

Comments

@hron84
Copy link
Contributor

hron84 commented Apr 13, 2012

When I try render forms, I sometime got an empty page with latest Git master

I set my gemfile to 4b21623 ref because this is a last known good version. I dunno what happened between that and master, but something broken.

Code:

ActiveAdmin.register Account do
  # ...
  form do |f|
    f.inputs do
      f.input :package, :hint => 'Select empty package to edit quota', :input_html => { :disabled => (!f.object.package.blank?) }
      f.input :quota, :as => :select, :collection => quota_collection, :input_html => { :class => 'quota', :disabled => (!f.object.package.blank?) }
      f.input :email_quota, :as => :select, :collection => quota_collection, :input_html => { :class => 'quota', :disabled => (!f.object.package.blank?) }
      f.input :active
      f.input :owner, :as => :select, :collection => User.all, :input_html => { :disabled => (!f.object.owner.blank?) }
      unless f.object.owner.blank?
        f.input :owner_id, :as => :hidden, :value => f.object.owner.id
      end
    end

    f.buttons
  end
end

No stacktrace, no info about what happened, just renders an empty form. All requests to models are covered by tests and no problem there.

Env: Ruby 1.8.7 Rails 3.1.3

@cloud8421
Copy link

Having a similar issue with 0.4.3, where the form arbre block returns only the latest input inside f.inputs instead of the whole f.inputs block.

@samadhiBot
Copy link
Contributor

All form inputs were disappearing after changing f.buttons to f.actions in active_admin 0.4.3 / formtastic 2.2. Things are working again using active_admin master, formtastic 2.1.1 and reverting back to f.buttons for now.

@jancel
Copy link
Contributor

jancel commented Apr 23, 2012

related to #1224

@hron84
Copy link
Contributor Author

hron84 commented May 2, 2012

This issue happens in production mode with formtastic 2.1.1 and AA 4b21623 ... I really not have an idea what is the real problem...
I worked around the previously pasted code by moving conditional element to the first place. I think there is a bug about how arbre handles nil.

@jamesduncombe
Copy link

I can confirm that this happens when using f.actions as opposed to f.buttons with Formtastic 2.1.1 and ActiveAdmin 0.4.4.

@jpmckinney
Copy link
Contributor

Doesn't this have to do with putting a conditional as the last item in the inputs block? AA has trouble when a block returns nil. Potential duplicate of #965.

@hron84
Copy link
Contributor Author

hron84 commented Jul 22, 2012

@jpmckinney yeah, the correct workaround is avoiding putting conditional as the last item.

And I confirm, this is a dupe of #965

@jpmckinney
Copy link
Contributor

Closing as dupe.

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

No branches or pull requests

6 participants