Commit 18bdb58e by ivan Lan

Add series to product show & Add uniq validation for spec of series

parent 11ba283c
......@@ -3,3 +3,4 @@ json.extract! product, :id, :title, :status, :need_express, :need_time_attr,
# TODO: NOTE: catalog_list is only vaild in the template example
json.catalog_list product.catalog_list
json.default_series product.default_series, partial: 'shotengai/share/series_simple', as: :series
json.series product.series, partial: 'shotengai/share/series_simple', as: :series
\ No newline at end of file
......@@ -96,7 +96,12 @@ module Shotengai
end
def resource_params
params.requrie(resource_key)
params.requrie(resource_key).permit!.merge other_resource_params
end
# rewrite this to add more custom column
def other_resource_params
params.require(resource_key).permit!
end
end
end
......
......@@ -43,11 +43,6 @@ module Shotengai
other_resource_params
)
end
# rewrite this to add more custom column
def other_resource_params
params.require(resource_key).permit()
end
end
end
end
......
......@@ -23,6 +23,7 @@ module Shotengai
class Series < ActiveRecord::Base
self.table_name = 'shotengai_series'
validate :check_spec, if: :spec
validates_uniqueness_of :spec, scope: :shotengai_products_id
delegate :detail, :banners, :cover_image, to: :product
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment