lib/smithy/content_blocks/registry.rb in smithycms-0.7.3 vs lib/smithy/content_blocks/registry.rb in smithycms-0.8.1

- old
+ new

@@ -18,11 +18,10 @@ def register(content_block) return unless ActiveRecord::Base.connection.table_exists?(Smithy::ContentBlock.table_name) return unless ActiveRecord::Base.connection.table_exists?(content_block.table_name) content_block_name = content_block.to_s.demodulize @@content_blocks << content_block_name unless @@content_blocks.include?(content_block_name) - cb = Smithy::ContentBlock.find_or_initialize_by(name: content_block_name) - cb.save + Smithy::ContentBlock.find_or_create_by(name: content_block_name) @@content_blocks end end end end