Skip to content

Commit

Permalink
Make page number optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoverlover committed Jan 7, 2013
1 parent 349a320 commit 428b251
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/prawn-fillform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ def fill_form_with(data={})
fields.each do |field|
number = page.to_s.split("_").last.to_i
go_to_page(number)
value = data[page][field.name].fetch(:value) rescue nil
options = data[page][field.name].fetch(:options) rescue nil

field_hash = data[page].try(:[], field.name) || data[field.name]

value = field_hash.fetch(:value) rescue nil
options = field_hash.fetch(:options) rescue nil
options ||= {}

if value
Expand Down

0 comments on commit 428b251

Please sign in to comment.