Skip to content

Commit

Permalink
Fix for issue activeadmin#197 by marshalling options in form_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfb authored and whatthewhat committed Aug 13, 2011
1 parent 15fd583 commit a6e0617
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions features/edit_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,35 @@ Feature: Edit Page
And I should see the attribute "Title" with "Hello World from update"
And I should see the attribute "Author" with "John Doe"

Scenario: Generating a custom form with :html set, visiting the new page first (bug probing issue #109)
Given a configuration of:
"""
ActiveAdmin.register Post do
form :html => {} do |f|
f.inputs "Your Post" do
f.input :title
f.input :body
end
f.inputs "Publishing" do
f.input :published_at
end
f.buttons
end
end
"""
Given I follow "New"
Then I follow "Posts"
Then I follow "Edit"
Then I should see a fieldset titled "Your Post"
And I should see a fieldset titled "Publishing"
And the "Title" field should contain "Hello World"
And the "Body" field should contain ""
When I fill in "Title" with "Hello World from update"
When I press "Update Post"
Then I should see "Post was successfully updated."
And I should see the attribute "Title" with "Hello World from update"
And I should see the attribute "Author" with "John Doe"

Scenario: Generating a form from a partial
Given "app/views/admin/posts/_form.html.erb" contains:
"""
Expand Down
1 change: 1 addition & 0 deletions lib/active_admin/view_helpers/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module ViewHelpers
module FormHelper

def active_admin_form_for(resource, options = {}, &block)
options = Marshal.load( Marshal.dump(options) )
options[:builder] ||= ActiveAdmin::FormBuilder
semantic_form_for resource, options, &block
end
Expand Down

0 comments on commit a6e0617

Please sign in to comment.