Sha256: f5d39c376ca61e7b4ac97ee6333bda5e0f3909d4bc51ffa9458d25ac2c57a6a6
Contents?: true
Size: 791 Bytes
Versions: 12
Compression:
Stored size: 791 Bytes
Contents
module Admin class PropertiesController < Admin::ApplicationController INSTANCES = { label: Property::Label, image: Property::Image }.with_indifferent_access helper_method :post def create instance = instance_for_property(params[:property]) @property = instance.create(params) render "admin/properties/#{instance.name}/create" end def destroy instance = instance_for_property(params[:property]) @property = instance.destroy(params) render "admin/properties/#{instance.name}/destroy" end protected def post @post ||= Admin::Post.find(params[:post_id]) end def instance_for_property(name) instance = INSTANCES[name].new instance.post = post instance end end end
Version data entries
12 entries across 12 versions & 1 rubygems