Merge pull request #80 from mariovisic/hotfix/import_content_type_date

Fix: Content type fields import does not support dates in yaml
This commit is contained in:
Didier Lafforgue 2011-05-24 15:39:31 -07:00
commit 408de3dc85
3 changed files with 2 additions and 2 deletions

View File

@ -79,7 +79,7 @@ module Locomotive
value = (case field.kind.downcase value = (case field.kind.downcase
when 'file' then self.open_sample_asset(value) when 'file' then self.open_sample_asset(value)
when 'boolean' then Boolean.set(value) when 'boolean' then Boolean.set(value)
when 'date' then Date.parse(value) when 'date' then value.is_a?(Date) ? value : Date.parse(value)
when 'category' when 'category'
if field.category_items.detect { |item| item.name == value }.nil? if field.category_items.detect { |item| item.name == value }.nil?
field.category_items.build :name => value field.category_items.build :name => value

Binary file not shown.

View File

@ -22,7 +22,7 @@ describe Locomotive::Import::Job do
it 'adds content types' do it 'adds content types' do
@site.content_types.count.should == 2 @site.content_types.count.should == 2
content_type = @site.content_types.where(:slug => 'projects').first content_type = @site.content_types.where(:slug => 'projects').first
content_type.content_custom_fields.size.should == 6 content_type.content_custom_fields.size.should == 7
end end
it 'converts correctly the order_by option for content types' do it 'converts correctly the order_by option for content types' do