Sha256: 0c9b6cb6321bb8fc8d69b6b58cd641783b367203a11efdabf80f35a349f934d3

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

require_dependency 'cavy/application_controller'

module Cavy
  class AdminPageDataController < ApplicationController
    layout 'cavy/admin_layout'

    def new
      @page = Cavy::Page.find(params[:id])
      render 'cavy/admin_pages/data/new'
    end

    def create
      @page = Cavy::Page.find(params[:id])
      @page.set_key_value(params[:page][:key], params[:page][:value])
      if @page.save
        redirect_to admin_edit_page_path(@page.id), flash: { success: 'Successfully updated page.' }
      else
        render action :new
      end
    end

    private

    def page_params
      # TODO: Find a way to use hstore with strong parameters
      # params.require(:page).permit(:title, :render, :route, :tag_string, :description, :key, :value, :data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cavy-0.1.0.beta2 app/controllers/cavy/admin_page_data_controller.rb