As seen in previous projects, we will mockup our application page and create a sample layout similar to Pinterest as follows:
In this section, we will use the carrierwave
gem to upload images and resize them into different sizes in order to display them on different pages. For example, we will display thumbnails on listing pages and larger images on individual pages.
Before we start off with creating the upload methods, we will create two models and controllers for board
and pin
as follows:
$ rails g scaffold board title:string description:text $rails g scaffold pin name:string image:string board_id:integer
We will create an association between pin
and board
as follows:
models/pin.rb belongs_to :board models/board.rb has_many :pins
A user model is generated using the devise
gem. We will also create an association between user
and boards
:
models/board.rb belongs_to :user models/user.rb has_many :boards
We will also use friendly_id...