#472: Update Api::V1::ProductsController

This commit is contained in:
Vokhmin Alexey V 2015-05-19 23:48:52 +03:00
parent 054ba736a5
commit 789879b4bc
3 changed files with 18 additions and 8 deletions

View File

@ -5,7 +5,7 @@ class Api::V1::ProductsController < Api::V1::BaseController
before_action :load_product, except: :create before_action :load_product, except: :create
def create def create
create_subject @product = Product.new(params[:product]) create_subject @product = Product.new(subject_params(Product))
end end
def update def update

View File

@ -16,13 +16,6 @@ class Product < ActiveRecord::Base
scope :recent, -> { order(:name) } scope :recent, -> { order(:name) }
# attr_accessible :name,
# :description,
# :project_id,
# :main_script,
# :params,
# :platform_id,
# :project_version
attr_readonly :platform_id attr_readonly :platform_id
def full_clone(attrs = {}) def full_clone(attrs = {})

View File

@ -17,4 +17,21 @@ class ProductPolicy < ApplicationPolicy
alias_method :destroy?, :create? alias_method :destroy?, :create?
alias_method :update?, :create? alias_method :update?, :create?
# Public: Get list of parameters that the user is allowed to alter.
#
# Returns Array
def permitted_attributes
%i(
autostart_status
description
main_script
name
params
platform_id
project_id
project_version
time_living
)
end
end end