app/controllers/annex/blocks_controller.rb in annex-cms-0.2.1 vs app/controllers/annex/blocks_controller.rb in annex-cms-0.3.0

- old
+ new

@@ -3,18 +3,13 @@ module Annex class BlocksController < ApplicationController # POST /annex/blocks def create - @block = Block.where(:route => params[:route]).first_or_create - @block.content ||= {} + @block = Block.builder(params) - params[:content].keys.each do |key| - @block.content[key] = params[:content][key] - end - if @block.save - render json: {status: :success}, status: :ok + render json: { status: :success }, status: :ok else render json: @block.errors, status: :unprocessable_entity end end