Commit 193525ad by Dao Minh Nhut

fix code convention

parent 2cbd592f
......@@ -8,7 +8,7 @@ class ProductsController < ApplicationController
def index
@item = Product.find(:all)
#@items = Product.all.select do |i|
# i.category==params[:id]
#i.category==params[:id]
#end
end
def new
......@@ -24,13 +24,12 @@ class ProductsController < ApplicationController
render 'new', layout: "another_layout"
end
end
def destroy
@item.destroy
redirect_to current_user
end
private
def correct_user
@item = current_user.items.find_by_id(params[:id])
redirect_to root_url if @item.nil?
......
<div class="span9 categories">
<% @items_of_category.each do |i| %>
<div class="span5 center">
<h4><%= i.name%></h4>
......
......@@ -2,11 +2,10 @@
<div class="sidebar-nav-fixed">
<div class="well">
<ul class="nav nav-list">
<li class="nav-header">Category</li>
<!--% category_list.each do |cat| %-->
<li><a href='/categories/<%= cat.id%>'><%=cat.name%></a></li>
<%end%>
<!--%end%-->
</ul>
</div><!--/.well -->
</div> <!--/sidebar-nav-fixed -->
......
<div class="span8 center">
<h3>Name: </h3><%= @item.name%><br><br>
<h3>Name: </h3><%= @product.name%><br><br>
</div><!--/span-->
\ No newline at end of file
......@@ -15,7 +15,7 @@ ActiveRecord::Schema.define(version: 20150721071537) do
create_table "categories", force: :cascade do |t|
t.string "name", limit: 255
t.string "description", limit: 255
t.string "description", limit: 65535
t.string "image", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
......@@ -25,7 +25,7 @@ ActiveRecord::Schema.define(version: 20150721071537) do
t.string "name", limit: 255
t.string "image", limit: 255
t.integer "price", limit: 4
t.string "description", limit: 255
t.string "description", limit: 65535
t.integer "category_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
......
namespace :products do
namespace :products do
desc 'Get products'
task import: :environment do
ImportAmazon.new.import_product
end
end
end
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