Exciting personal development with Rails Part 1: Try designing specifications and DB

I will do personal development

In the previous article, it became possible to build a set of logic using Ruby. That's why I decided to make something with Rails this time. Let's create some kind of web service.

Write a rough specification

Anyway, I needed something like a specification. I want to clarify what I want to do. What I want to make is ** "Waiwai Observation Diary" **. I want to be able to share the growth record of foliage plants with everyone. In the meantime, I would like to be able to exchange various data by linking IoT products and data.

https://github.com/kyokucho1989/waiwai-kantatsu-nikki

#Wai Wai Observation Diary

##What is this
A web service to share a diary of observing plants
(Limited to indoor plants)

##What are the benefits?
By sharing the cultivation record, you can keep the motivation to grow.

##User assumption
-People who started growing Saikin plants at home
-People who like foliage plants

##Monetize
-Advertisement placement (such as plant seeds?)
-Parts sales

##How to increase content
-Will the initial user quietly post to the content 0 service? → No
-The developer himself posts little by little

##Functions to be added
###Beta (minimum)
-Login function
-Plant registration
-Record of temperature and humidity

### ver 1.1
-Photo posting (smartphone/From PC)
-Badge function
You can get a badge by posting every day

-Post a comment to your own record

### ver 1.2
-Post a comment to another user's record

### ver 2.0
-Data transmission from IoT devices
soracom GPS multi-unit

 https://soracom.jp/products/kit/gps_multiunit/

It's important to start small. We will release it when the minimum functions are completed, and let's do it later.

DB design

This time, it became necessary to design a DB. You have to summarize the types and relevance of the data. I'm not sure about the details, but it seems good to do it first.

https://github.com/kyokucho1989/waiwai-kantatsu-nikki/blob/master/db-design.md

I decided to write some data that I haven't planned to implement yet. Then it will be nice. The important thing is the relationship between User and Plant. One user can have multiple Plants. Plants cannot be shared between users. (Then it seems to be troublesome)

In such a case, it seems that one-to-many association is performed. After creating the model, add it to ʻuser.rb`` plant.rb in ʻapp / models.

plant.rb

class Plant < ApplicationRecord
  belongs_to :user
end

user.rb

class User < ApplicationRecord
  has_many :plants
end

I will implement the function little by little

When I first started personal development, I realized that motivation management seemed to be very difficult. The only way to get through this is to break up your goals and step up. I decided to use the issue function of github. Record the feelings of "I want to change here!" And "I want to do this much!" In the issue, and crush the issues one by one.

I'm a forgetful creature, so I'd like to post it to Qiita as often as possible to leave memories of my personal development.

Next, I will write about the implementation of the user login function and the creation of nested resources.

github is here

https://github.com/kyokucho1989/waiwai-kantatsu-nikki

Recommended Posts

Exciting personal development with Rails Part 1: Try designing specifications and DB
Rails development environment created with VSCode and devcontainer
[Rails] Development with MySQL
Try using view_component with rails
Try DB connection with Java
Comparison of WEB application development with Rails and Java Servlet + JSP
[Personal note] Rails DB index consideration
[Copy and paste] Build a Laravel development environment with Docker Compose Part 2