]> nos-oignons.net Git - gestion-adh.git/commitdiff
Manually select YAML content in member pages
authorLunar <lunar@anargeek.net>
Mon, 3 Jun 2013 10:01:55 +0000 (12:01 +0200)
committerLunar <lunar@anargeek.net>
Mon, 3 Jun 2013 10:01:59 +0000 (12:01 +0200)
This works around a strang bug in the safe_yaml gem.

features/support/fixtures.rb
lib/nos_oignons/member.rb

index fb06a0c0f27da5597c4fb384ce83e7788912ffa8..8280d7967f479a781f10cf368b0b01c115850ab8 100644 (file)
@@ -62,6 +62,7 @@ email: <%= email %>
 joined_on: <%= joined_on %>
 membership_fee_paid_on: <%= membership_fee_paid_on %>
 ---
 joined_on: <%= joined_on %>
 membership_fee_paid_on: <%= membership_fee_paid_on %>
 ---
+[[!ftemplate id="membre"]]
 
 <%= notes %>
 END_OF_TEMPLATE
 
 <%= notes %>
 END_OF_TEMPLATE
index 8b0bd97a0f4b97a7d1e8b601c00341e0053cb1de..a67581c114ea6d06588e5442d8c8ffe53f676bf8 100644 (file)
@@ -59,7 +59,8 @@ module NosOignons
       unless page_content.start_with?("---\n")
         raise ArgumentError.new('content is not a proper YAML document')
       end
       unless page_content.start_with?("---\n")
         raise ArgumentError.new('content is not a proper YAML document')
       end
-      data = YAML.load(page_content)
+      yaml_content = /\A---\n(.*)\n---\n/m.match(page_content)[1]
+      data = YAML.load(yaml_content)
       MEMBER_FIELDS.each do |field|
         self[field] = data[field.to_s]
       end
       MEMBER_FIELDS.each do |field|
         self[field] = data[field.to_s]
       end