Explanation until the original application is completed

environment

macOS 10.15.5 Rails 5.2.4.2 Docker 19.03.12

Overview

The outline of the original application is the development of a simple memo application that is conscious of the CRUD system. We paid attention not to lack practicality even if it was a simple application. I implemented it so that the layout does not collapse even if the number of lines increases, and I also set the character limit and blank items so that they are not newly created.

The framework used Rails with Docker. And it's open to the public on Heroku.

About originality

Regarding HTML, the class name etc. used the learning site as a hint, and the design was inspired by the learning site, but the implementation was all self-propelled. I repeated the learning site many times in advance regarding the implementation of Rails functions, and after thinking about CRUD functions, I created this time. Therefore, I did not refer to the site as much as possible for short codes, implemented them with the contents I learned, and basically performed all command operations only with the contents I had in mind.

About the site

スクリーンショット 2020-08-01 23.23.27.png The list page is set as the top page, and links are specified so that individual details can be displayed for the memo items. At that time, we implemented so that newly posted items move to the top.

lists_controller.rb


class ListsController < ApplicationController
  def index
    @lists = List.all.order(created_at: :desc)
  end

New page

スクリーンショット 2020-08-01 23.23.45.png On the newly created page, blank content and content of 141 characters or more are not executed.

list.rb


class List < ApplicationRecord
  validates :content, {presence: true, length: {maximum: 140}}
end

Details page

スクリーンショット 2020-08-01 23.24.43.png You can see the individual details page by navigating from the link of each item in the memo list. From there you can "edit" and "delete".

Edit page

スクリーンショット 2020-08-01 23.24.55.png The edit page is implemented so that the contents before editing are displayed when the page is opened.

ruby:edit.html.erb


<div class="form-bady">
  <textarea name="content"><%= @list.content %></textarea>
  <input type="submit" value="Edit">
</div>

lists_controller.rb


def edit
  @list = List.find_by(id: params[:id])
end

What I was aware of when creating the original app

I want to acquire skills as a self-propelled engineer! With that in mind, I often ask myself what kind of method is the way to get closer to such an engineer. This time I thought about creating this simple memo app because I wanted to completely incorporate Rails' CRUD functions and MVC, so I summarized it in this simplicity. In the future, I would like to work on creating apps that have functions such as login function and page creation with access authority for each user!

Recommended Posts

Explanation until the original application is completed
Until the code is executed
GoogleMap is not displayed until the browser is reloaded
[Introduction to Docker] ~ The shortest explanation until starting jupyter lab ~
[Java] [Play Framework] Until the project is started with Gradle
Time is wrong with the application launched on the Docker container
Logback log is not output when the server application is closed