rails server -b $IP -p $PORT
rails generate scaffold product name:string photo:string description:text price:decimal is_available:boolean
rails db:migrate
gem 'activeadmin'
# Plus integrations with:
gem 'devise'
gem 'cancan' # or cancancan
gem 'draper'
gem 'pundit'
rails generate active_admin:install
rails generate active_admin:resource Product
ActiveAdmin.register Product do
permit_params do
[:name, :photo, :description, :price, :is_available]
end
end
rails db:migrate
rails db:seed
rails generate uploader Photo
class Product < ActiveRecord::Base
mount_uploader :photo, PhotoUploader
end
$ sudo apt-get update
$ sudo apt-get install imagemagick