added decoration support
This commit is contained in:
@@ -3,7 +3,8 @@ class Item < ActiveRecord::Base
|
|||||||
CSV_COL = {
|
CSV_COL = {
|
||||||
:code => 0,
|
:code => 0,
|
||||||
:input_price => 1,
|
:input_price => 1,
|
||||||
:list_price => 2
|
:list_price => 2,
|
||||||
|
:decoration => 3
|
||||||
}
|
}
|
||||||
|
|
||||||
belongs_to :unit
|
belongs_to :unit
|
||||||
@@ -117,6 +118,7 @@ class Item < ActiveRecord::Base
|
|||||||
else
|
else
|
||||||
item.current_input_price = row[CSV_COL[:input_price]]
|
item.current_input_price = row[CSV_COL[:input_price]]
|
||||||
item.list_price = row[CSV_COL[:list_price]]
|
item.list_price = row[CSV_COL[:list_price]]
|
||||||
|
item.decoration = row[CSV_COL[:decoration]]
|
||||||
item.save!
|
item.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddDecorationToItem < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :items, :decoration, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150726161256) do
|
ActiveRecord::Schema.define(version: 20151124061357) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -135,6 +135,7 @@ ActiveRecord::Schema.define(version: 20150726161256) do
|
|||||||
t.decimal "weight", precision: 5, scale: 3
|
t.decimal "weight", precision: 5, scale: 3
|
||||||
t.integer "delivery_time_estimation_id"
|
t.integer "delivery_time_estimation_id"
|
||||||
t.integer "brand_id"
|
t.integer "brand_id"
|
||||||
|
t.string "decoration"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "link_banners", force: :cascade do |t|
|
create_table "link_banners", force: :cascade do |t|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ class MultiMediaDescription < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resized_url
|
def resized_url
|
||||||
url.gsub('/upload/v','/upload/c_lpad,h_281,w_375/v')
|
decoration_slug = item.decoration.present? ? "/#{item.decoration}" : ""
|
||||||
|
url.gsub('/upload/v',"/upload/c_lpad,h_281,w_375#{decoration_slug}/v")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user