Skip to content

AramSong/rails_project-Day1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

180614 Day6

  • ์˜ค์ „ ๊ณผ์ œ
    • ORM์ด๋ž€?

Controller

  • ์—ญํ• ?

    • ์„œ๋น„์Šค ๋กœ์ง ์„ ๊ฐ€์ง€๊ณ  ์žˆ์Œ
  • ๊ทธ๋™์•ˆ app.rb์—์„œ ์ž‘์„ฑํ–ˆ๋˜ ๋ชจ๋“  ๋‚ด์šฉ์ด Controller์— ๋“ค์–ด๊ฐ

  • Controller๋Š” ํ•˜๋‚˜์˜ ์„œ๋น„์Šค์— ๋Œ€ํ•ด์„œ๋งŒ ๊ด€๋ จํ•œ๋‹ค.

    • ์˜ˆ๋ฅผ ๋“ค์–ด ๊ฒŒ์‹œํŒ์˜ ๊ธฐ๋Šฅ ์ฝ˜ํŠธ๋กค๋Ÿฌ๋Š” ๊ฒŒ์‹œํŒ ์ฝ˜ํŠธ๋กค๋Ÿฌ
    • ์—…๋ฐ์ดํŠธ๋ฅผ ๋‹ด๋‹นํ•  ๋•Œ๋Š” ์—…๋ฐ์ดํŠธ ์ฝ˜ํŠธ๋Ÿด๋กœ ๋ฌถ๋Š” ์‹
  • Controller๋ฅผ ๋งŒ๋“ค ๋•Œ์—๋Š” $ rails g controller ์ปจํŠธ๋กค๋Ÿฌ๋ช…์„ ์ด์šฉํ•œ๋‹ค.

$ rails g controller home
# app/controllers/home_controller.rb ํŒŒ์ผ ์ƒ์„ฑ
      create  app/controllers/home_controller.rb
      invoke  erb
      create    app/views/home
      invoke  test_unit
      create    test/controllers/home_controller_test.rb
      invoke  helper
      create    app/helpers/home_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/home.coffee
      invoke    scss
      create      app/assets/stylesheets/home.scss

app/controllers/home_controller.rb

class HomeController < ApplicationController
    #์ƒ๋‹จ์˜ ์ฝ”๋“œ๋Š” ApplicationController๋ฅผ ์ƒ์†๋ฐ›๋Š” ์ฝ”๋“œ
end
# ์‹คํ–‰ ์ฝ”๋“œ 
#	$ rails s -b $IP -p $PORT
  • HomeController๋ฅผ ๋งŒ๋“ค๋ฉด app/views ํ•˜์œ„์— ์ปจํŠธ๋กค๋Ÿฌ ๋ช…๊ณผ ์ผ์น˜ํ•˜๋Š” ํด๋”๊ฐ€ ์ƒ๊ธด๋‹ค.
  • HomeController์—์„œ ์•ก์…˜(def)์„ ์ž‘์„ฑํ•˜๋ฉด ํ•ด๋‹น ์•ก์…˜๋ช…๊ณผ ์ผ์น˜ํ•˜๋Š” viewํŒŒ์ผ์„ app/views/home ํด๋” ๋ฐ‘์— ์ž‘์„ฑํ•œ๋‹ค.
  • ์‚ฌ์šฉ์ž์˜ ์š”์ฒญ์„ ๋ฐ›๋Š” url ์„ค์ •์€ config/routes.rb์—์„œ ํ•œ๋‹ค.

Rails์—๋Š” Development, Test, Production ํ™˜๊ฒฝ(๋ชจ๋“œ)๊ฐ€ ์žˆ๋‹ค.

Development ํ™˜๊ฒฝ์—์„œ๋Š” ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์ž๋™์ ์œผ๋กœ ํ™•์ธ๋˜๊ณ , ๋ชจ๋“  ๋กœ๊ทธ๊ฐ€ ์ฐํžŒ๋‹ค.

Production ํ™˜๊ฒฝ์—์„œ๋Š” ๋ณ€๊ฒฝ์‚ฌํ•ญ๋„ ์ž๋™์ ์œผ๋กœ ์ €์žฅ๋˜์ง€ ์•Š๊ณ , ๋กœ๊ทธ๋„ ์ผ๋ถ€๋งŒ. $ rails s ๋กœ ์„œ๋ฒ„๋ฅผ ์‹คํ–‰ํ•˜์ง€ ์•Š๋Š”๋‹ค.

  • ์‚ฌ์šฉ์ž์˜ ์š”์ฒญ์„ ๋ฐ›๋Š” url ์„ค์ •์€ config/routes.rb์—์„œ ํ•œ๋‹ค.
    • ์ฃผ์†Œ๋ฅผ ๋ฐ›๋Š” ์—ญํ• ์€ routes.rb์—์„œ ๋‹ค ํ•œ๋‹ค.
      • get () do ํ˜•์‹์œผ๋กœ ์•ˆ ํ•ด๋„ ๋œ๋‹ค.
#Rails์—๋Š” Development, Test, Productionํ™˜๊ฒฝ(๋ชจ๋“œ)๊ฐ€ ์žˆ๋‹ค.
#Development ํ™˜๊ฒฝ์—์„œ๋Š” ๋ณ‘๊ฒฝ์‚ฌํ•ญ์ด ์ž๋™์ ์œผ๋กœ ํ™•์ธ๋˜๊ณ , ๋ชจ๋“  ๋กœ๊ทธ๊ฐ€ ์ฐํžŒ๋‹ค.
#Production ํ™˜๊ฒฝ์—์„œ๋Š” ๋ณ€๊ฒฝ์‚ฌํ•ญ๋„ ์ž๋™์ ์œผ๋กœ ์ €์žฅ๋˜์ง€ ์•Š๊ณ , ๋กœ๊ทธ๋„ ์ผ๋ถ€๋งŒ. `rails s`๋กœ ์‹คํ–‰ํ•˜์ง€ ์•Š๋Š”๋‹ค.

๊ฐ„๋‹จ๊ณผ์ œ

  • ์ ์‹ฌ๋ฉ”๋‰ด๋ฅผ ๋žœ๋ค์œผ๋กœ ๋ณด์—ฌ์ค€๋‹ค.
  • ๊ธ€์ž + ์ด๋ฏธ์ง€๊ฐ€ ์ถœ๋ ฅ๋œ๋‹ค.
  • ์ ์‹ฌ๋ฉ”๋‰ด๋ฅผ ์ €์žฅํ•˜๋Š” ๋ณ€์ˆ˜๋Š” Hashํƒ€์ž…์œผ๋กœ ํ•œ๋‹ค.
    • @lunch = { "์ ์‹ฌ๋ฉ”๋‰ด ์ด๋ฆ„" => "https://... .jpg"}
    • Hash์—์„œ ๋ชจ๋“  key ๊ฐ’์„ ๊ฐ€์ ธ์˜ค๋Š” ๋ฉ”์†Œ๋“œ๋Š” .keys์ด๋‹ค.
  • ์š”์ฒญ์€ /lunch๋กœ ๋ฐ›๋Š”๋‹ค.

Model

#๋ชจ๋ธ ์ƒ์„ฑ-๊ตฌ์กฐ๋งŒ(db/migrate์— 20180614021020_create_users.rb ์ƒ์„ฑ)
$ rails g model ๋ชจ๋ธ๋ช…
	  invoke  active_record
      create    db/migrate/20180614021008_create_users.rb
      create    app/models/user.rb
      invoke    test_unit
      create      test/models/user_test.rb
      create      test/fixtures/users.yml
      
# ์‹ค์ œ DB์— ์Šคํ‚ค๋งˆ ํŒŒ์ผ๋Œ€๋กœ ์ ์šฉํ•˜๊ธฐ
$ rake db:migrate
$ rake db:drop # DB ๊ตฌ์กฐ๋ฅผ ์ˆ˜์ •ํ–ˆ์„ ๊ฒฝ์šฐ drop์„ ํ†ตํ•ด DB๋ฅผ ๋‚ ๋ฆฐ๋‹ค์Œ ๋‹ค์‹œ migrate ํ•ด์ค€๋‹ค
 $ rails c
Running via Spring preloader in process 3331
Loading development environment (Rails 5.0.7)
2.3.4 :001 > User.methods

#User ํ•˜๋‚˜ ์ƒ์„ฑ
2.3.4 :002 > User.new
 => #<User id: nil, username: nil, password: nil, created_at: nil, updated_at: nil> 

#User์˜ ์ธ์Šคํ„ด์Šค ํ•˜๋‚˜๋ฅผ u1์— ์ง‘์–ด๋„ฃ๋Š”๋‹ค.
# ํ•˜๋‚˜์˜ User๊ฐ€ ์ƒ๊ฒผ๋‹ค.
2.3.4 :003 > u1 = User.new
 => #<User id: nil, username: nil, password: nil, created_at: nil, updated_at: nil> 

#u1์„ ์ €์žฅํ•œ๋‹ค.
2.3.4 :004 > u1.save
   (0.2ms)  begin transaction
  SQL (1.4ms)  INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)  [["created_at", "2018-06-14 02:23:26.152735"], ["updated_at", "2018-06-14 02:23:26.152735"]]
   (11.0ms)  commit transaction
 => true 

#๋„๊ฐ’์„ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋‹ˆ username์— ๊ฐ’์„ ์ง‘์–ด๋„ฃ๋Š”๋‹ค.
2.3.4 :007 > u1.username = "haha"
 => "haha" 
2.3.4 :008 > u1
 => #<User id: 1, username: "haha", password: nil, created_at: "2018-06-14 02:23:26", updated_at: "2018-06-14 02:23:26">   
2.3.4 :008 > u1.save
  • Rails๋Š” ORM(Object Relation Mapper)์„ ๊ธฐ๋ณธ์ ์œผ๋กœ ์žฅ์ฐฉํ•˜๊ณ  ์žˆ์Œ(Active Record)
  • migrate ํŒŒ์ผ์„ ์ด์šฉํ•ด์„œ DB์˜ ๊ตฌ์กฐ๋ฅผ ์žก์•„์ฃผ๊ณ  ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์‹ค์ œ DB๋ฅผ ์ƒ์„ฑ/๋ณ€๊ฒฝ ํ•œ๋‹ค.
  • Model ํŒŒ์ผ์„ ์ด์šฉํ•ด์„œ DB์— ์žˆ๋Š” ์ž๋ฃŒ๋ฅผ ์กฐ์ž‘ํ•จ
> u1 = User.new # ๋นˆ ๊ป๋ฐ๊ธฐ(ํ…Œ์ด๋ธ”์—์„œ row ํ•œ์ค„)๋ฅผ ๋งŒ๋“ ๋‹ค.
> u1.user_name = "haha" # ์ž๋ฃŒ์กฐ์ž‘
> u1.password = "1234"
> u1.save # ์‹ค์ œ DB์— ๋ฐ˜์˜(์ €์žฅ)
> u1.password = "4321"
> u1.save

User์™€ ๊ด€๋ จ๋œ Model๊ณผ Controller ๋งŒ๋“ค๊ธฐ

  • ์ƒˆ๋กœ์šด ์œ ์ €๋ฅผ ๋“ฑ๋กํ•˜๊ณ , ๋ณด์—ฌ์ฃผ๋Š” ์ปจํŠธ๋กค๋Ÿฌ์™€ ๋ชจ๋ธ์„ ๋งŒ๋“ค์–ด ๋ด…์‹œ๋‹ค.
$ rails g model user
$ rails g controller user

db/migrate/create_user.rb

class CreateUsers < ActiveRecord::Migration[5.0]
  def change
    create_table :users do |t|
      
      t.string "user_name"
      t.string "password"

      t.timestamps
    end
  end
end

app/controllers/ user_controller

class UserController < ApplicationController
    def index
        @users = User.all
    end
    
    def new
    end
    
    def create
        u1 = User.new
        u1.user_name = params[:user_name]
        u1.password = params[:password]
        u1.save
        redirect_to "/user/#{u1.id}"
    end
    
    def show
        @user = User.find(params[:id])
    end
end

config/routes.rb

Rails.application.routes.draw do
  get '/users' => 'user#index'
  get '/user/new' => 'user#new'
  get '/user/:id' => 'user#show'
  post '/user/create' => 'user#create'

end
  • route๋ฅผ ๋“ฑ๋กํ•  ๋•Œ, wildcard ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ ์ฃผ์˜ํ•ด์•ผํ•  ์ ์ด ์žˆ๋Š”๋ฐ, /user/new์˜ new๋„ ํ•˜๋‚˜์˜ id๋กœ์„œ ์ธ์‹ํ•˜๊ฒŒ ๋  ์ˆ˜ ์žˆ๋‹ค๋Š” ์ ์ด๋‹ค. ๊ทธ๋ž˜์„œ ๋ผ์šฐํŒ…์„ ๋“ฑ๋กํ•  ๋•Œ ๋จผ์ € /user/new๋ฅผ ๋“ฑ๋กํ•˜๊ณ  ๊ทธ ํ›„์— /user/:id๋ฅผ ๋“ฑ๋กํ•˜๋„๋ก ํ•œ๋‹ค.

app/views/user/index.html.erb

<ul>
    <% @users.each do |user| %>
    <li><%= user.user_name %></li>
    <% end %>
</ul>
<a href="/user/new">์ƒˆ ํšŒ์›๋“ฑ๋ก</a>

app/views/user/show.html.erb

<h1><%= @user.user_name %></h1>
<p><%= @user.password %></p>
<a href="/users">์ „์ฒด์œ ์ €๋ณด๊ธฐ</a>

app/views/user/new.html.erb

<form action="/user/create" method="POST">
    <input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>">
    <input type="text" name="user_name" placeholder="ํšŒ์›์ด๋ฆ„">
    <input type="password" name="password" placeholder="๋น„๋ฐ€๋ฒˆํ˜ธ">
    <input type="submit" value="๋“ฑ๋กํ•˜๊ธฐ">
</form>
  • Rails์—์„œ๋Š” POST ๋ฐฉ์‹์œผ๋กœ ์š”์ฒญ์„ ๋ณด๋‚ผ ๋•Œ(์ƒˆ๋กœ์šด ์ •๋ณด๊ฐ€ ๋“ฑ๋ก๋˜๋Š” ๊ฒฝ์šฐ) ๋ฐ˜๋“œ์‹œ ํŠน์ • ํ† ํฐ์„ ํ•จ๊ป˜ ๋ณด๋‚ด๊ฒŒ ๋˜์–ด ์žˆ๋‹ค. ํ›„์—๋Š” form_tag์™€ ๊ฐ™์€ ํŠน๋ณ„ํ•œ ๋ ˆ์ผ์ฆˆ ๋ฌธ๋ฒ•์„ ํ†ตํ•ด ์‰ฝ๊ฒŒ ํ† ํฐ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์ง€๋งŒ ์ง€๊ธˆ ์‹œ์ ์—์„œ๋Š” form_authenticity_token์˜ ํ˜•์‹์œผ๋กœ ํ† ํฐ์„ ๋งŒ๋“ค์–ด ๋ณด๋‚ด๋„๋ก ํ•œ๋‹ค.

๊ฐ„๋‹จ๊ณผ์ œ

  • ๊ทธ๋™์•ˆ์— ๋ฝ‘ํ˜“๋˜ ๋‚ด์—ญ์„ ์ €์žฅํ•ด์ฃผ๋Š” ๋กœ๋˜๋ฒˆํ˜ธ ์ถ”์ฒœ๊ธฐ
  • /lotto => ์ƒˆ๋กœ ์ถ”์ฒœ๋ฐ›์€ ๋ฒˆํ˜ธ๋ฅผ ์ถœ๋ ฅ
    • a ํƒœ๊ทธ๋ฅผ ์ด์šฉํ•ด์„œ ์ƒˆ๋กœ์šด ๋ฒˆํ˜ธ๋ฅผ ๋ฐœ๊ธ‰
    • ์ƒˆ๋กœ ๋ฐœ๊ธ‰๋œ ๋ฒˆํ˜ธ๊ฐ€ ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰๊ณผ ์ตœ ์ƒ๋‹จ์— ๊ฐ™์ด
    • ์ตœ ์ƒ๋‹จ์˜ ๋ฉ”์‹œ์ง€๋Š” ์ด๋ฒˆ์ฃผ ๋กœ๋˜ ๋ฒˆํ˜ธ๋Š” [...] ์ž…๋‹ˆ๋‹ค
  • /lotto/new => ์‹ ๊ทœ ๋ฒˆํ˜ธ๋ฅผ ๋ฐœ๊ธ‰, ์ €์žฅ ํ›„ /lotto๋กœ ๋ฆฌ๋””๋ ‰์…˜
  • ๋ชจ๋ธ๋ช…: Lotto
  • ์ปจํŠธ๋กค๋Ÿฌ๋ช…: LottoController
$ rake db:migrate	#ํŒŒ์ผ์ด ์ƒˆ๋กœ ๋งŒ๋“ค์–ด์ง€๋Š” ๊ฒฝ์šฐ์—” migrate๋ฅผ ํ•ด๋„ ๋ฌด๊ด€(dropํ•˜์ง€ ์•Š๊ณ  						migrate๋งŒ ํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ์ƒˆ๋กœ ์ƒ๊ฒจ๋‚œ migrationํŒŒ์ผ๋งŒ ์ ์šฉ์ด ๋œ๋‹ค.)
  • routes.rb
  get '/lotto' => 'lotto#index'    #lotto_cotroller์— index์•ก์…˜์œผ๋กœ
  get '/lotto/new' => 'lotto#new'  #lotto_cotroller์— new์•ก์…˜์œผ๋กœ
  • lotto_controller.rb
class LottoController < ApplicationController
    def index 
        @new_number = Lotto.last
        @numbers = Lotto.all
    end
    
    def new
        number = (1..45).to_a.sample(6).sort.to_s
        lotto = Lotto.new       #Lotto๋ผ๋Š” ํด๋ž˜์Šค์— ๊ป๋ฐ๊ธฐ ์ƒ์„ฑ
        lotto.numbers = number  #numbers column์— number ์ €์žฅ
        lotto.save              #์‹ค์ œ ํ…Œ์ด๋ธ”์— ์ €์žฅ๋  ์ˆ˜ ์žˆ๋„๋ก save
       
        redirect_to "/lotto"    #์™„์„ฑ๋œํ›„ /lotto๋กœ ๋˜๋Œ์•„๊ฐ„๋‹ค.
    end
    

end
  • VIEW lottoํด๋” ๋ฐ‘์— index.html.erb : ์•ก์…˜๋ช…๊ณผ ํŒŒ์ผ์ด๋ฆ„์ด ๊ฐ™์•„์•ผํ•œ๋‹ค

Lotto Controller, Lotto Model

$ rails g controller lotto
Running via Spring preloader in process 6415
      create  app/controllers/lotto_controller.rb
      invoke  erb
      create    app/views/lotto
      invoke  test_unit
      create    test/controllers/lotto_controller_test.rb
      invoke  helper
      create    app/helpers/lotto_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/lotto.coffee
      invoke    scss
      create      app/assets/stylesheets/lotto.scss	
$ rails g model lotto
Running via Spring preloader in process 6404
      invoke  active_record
      create    db/migrate/20180614053528_create_lottos.rb
      create    app/models/lotto.rb
      invoke    test_unit
      create      test/models/lotto_test.rb
      create      test/fixtures/lottos.yml
  1. ๋กœ๋˜๋ฒˆํ˜ธ ์ •๋ณด๋ฅผ ์ €์žฅํ•  numbers ์ปฌ๋Ÿผ์„ ์ถ”๊ฐ€ํ•œ๋‹ค.

db/migrate/create_lottos.rb

class CreateLottos < ActiveRecord::Migration[5.0]
  def change
    create_table :lottos do |t|
      
      t.string "numbers"

      t.timestamps
    end
  end
end

ํ•˜๋‚˜์˜ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด์„œ ๋จผ์ € ๋ชจ๋ธ๋ง(ํ…Œ์ด๋ธ” ๊ตฌ์กฐ)์— ๋Œ€ํ•ด์„œ ์ง€์ •ํ•˜๊ณ  model์— relation์„ ์ง€์ •ํ•œ๋‹ค. ๊ทธ ์ดํ›„์— ์–ด๋–ค ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์‚ฌ์šฉํ• ์ง€ ์–ด๋–ค ์•ก์…˜์„ ์‚ฌ์šฉํ• ์ง€ routes ํŒŒ์ผ์— ๋ช…์‹œํ•œ ์ดํ›„์— controller ํŒŒ์ผ์„ ์ž‘์„ฑํ•˜๋Š” ์ˆœ์„œ๋กœ ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค. ์ •ํ•ด์ง„ ๊ฒƒ์€ ์•„๋‹ˆ๊ธฐ์— ๋ณธ์ธ์ด ํŽธํ•œ ์ˆœ์„œ๋กœ ํ•˜๋ฉด ๋œ๋‹ค.

  1. ๋ผ์šฐํŒ…์„ ์„ค์ •ํ•œ๋‹ค

config/routes.rb

...
  get '/lotto' => 'lotto#index'
  get '/lotto/new' => 'lotto#new'
...
  • /lotto ์—์„œ๋Š” ์ „์ฒด ๋ฆฌ์ŠคํŠธ์™€ ์ƒˆ๋กœ ๋“ฑ๋ก๋œ ๋ฒˆํ˜ธ๋ฅผ ๋ณผ ๊ฒƒ์ด๊ณ , /lotto/new์—์„œ๋Š” ์ƒˆ๋กœ์šด ๋ฒˆํ˜ธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ €์žฅํ•œ ์ดํ›„์— ์ „์ฒด ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” /lotto๋กœ ๋ฆฌ๋””๋ ‰์…˜ ์‹œ์ผœ์ค€๋‹ค.
  1. controller logic
class LottoController < ApplicationController
    def index
        @new_number = Lotto.last
        p @new_number.class
        @numbers = Lotto.all
    end
    def new
        number = (1..45).to_a.sample(6).sort.to_s
        lotto = Lotto.new
        lotto.numbers = number
        lotto.save
        redirect_to '/lotto'
    end
end
  • index์—์„œ๋Š” ๊ฐ€์žฅ ์ตœ๊ทผ์— ์ €์žฅ๋œ ๋ฒˆํ˜ธ๋ฅผ ๋ถˆ๋Ÿฌ์˜จ๋‹ค. ์—ฌ๊ธฐ์—์„œ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ๋Š” ๋ถ€๋ถ„์€ ์ฒ˜์Œ์—๋Š” ์•„๋ฌด๋Ÿฐ ์ •๋ณด๋„ ์ €์žฅ๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋Š” ์ ์ด๋‹ค.
  1. view
<p>์ด๋ฒˆ์ฃผ ์ถ”์ฒœ ์ˆซ์ž๋Š” <%= @new_number.numbers %> ์ž…๋‹ˆ๋‹ค. </p>
<a href="/lotto/new">์ƒˆ๋ฒˆํ˜ธ ๋ฐœ๊ธ‰๋ฐ›๊ธฐ</a>
<ul>
    <% @numbers.each do |number| %>
        <li><%= number.numbers %></li>
    <% end %>
</ul>
  • ์ตœ์ดˆ ์ ‘์†์‹œ @new_number๊ฐ€ nil์ด๊ธฐ ๋•Œ๋ฌธ์— url๋กœ /lotto/new๋กœ ์ ‘์†์„ ์šฐ์„  ์‹œ๋„ํ•ด์„œ ํ•˜๋‚˜์˜ ์ •๋ณด๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์ข‹์„ ๊ฒƒ ๊ฐ™๋‹ค.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published