rpa게시판 글답변
본문 바로가기
메뉴열기
메뉴 닫기
아주방열린공장(홈)
나만의지도만들기W
가상쉬은라벨지만들기
텍스트QR
FAQ
1:1문의
접속자
3
새글
사용자메뉴
메뉴 닫기
사이트 내 전체검색
검색
뒤로가기
rpa게시판 글답변
rpa게시판 글답변
이름
필수
비밀번호
필수
이메일
홈페이지
옵션
html
제목
필수
내용
필수
웹에디터 시작
> > > 지난번에 만든 로또 놀라운 결과 발표 > > 데이터베이스의 개념과 CRUD 게시판 만들기 > https://www.youtube.com/watch?v=2CHkds265N8&list=PLU9-uwewPMe19RQNzTdSdewSgw92UI1kl&index=18 > > 세상에서 가장 쉬운 인공지능 만들기 1탄 | Teachable Machine으로 AI 과일도감 제작하기 > https://www.youtube.com/watch?v=USQGTW34lO8&list=PLU9-uwewPMe19RQNzTdSdewSgw92UI1kl&index=21 > > > rails g scaffold Post title:string content:string > > rails db:migrate > > rails g controller board index > > get '/board', to: 'board#index' > > rails g model post > > ------ routes.rb ------ > > Rails.application.routes.draw do > get '/board', to: 'board#index' > post '/create', to: 'board#create' > get '/edit', to: 'board#edit' > post '/update', to: 'board#update' > get '/delete', to: 'board#delete' > > # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html > end > > > > ----- _posts.rb ---------- > class CreatePosts < ActiveRecord::Migration[6.0] > def change > create_table :posts do |t| > t.string :title > t.text :content > > t.timestamps > end > end > end > > -------- index.html.erb ---- > <form action="/create" method="post"> > <input name="authenticity_token" value="<%= form_authenticity_token %>" type="hidden"> > 제목 : > <input type="text" name="title"><br> > 내용 : > <input type="text" name="content"><br><br> > <input type="submit" value="Submit"> > </form> > > > <%@posts.each do |post| %> > <h1> 제목 : <%=post.title%></h1> > <p>내용 : <%=post.content%></p> > <a href="/edit?id=<%=post.id%>">수정하기</a> > <a href="/delete?id=<%=post.id%>">삭제하기</a> > > <hr> > <% end %> > > > --- board_controllerl.rb ---- > class BoardController < ApplicationController > def index > @posts = Post.all > end > > def create > title1 = params[:title] > content1 = params[:content] > Post.create(title:title1, content: content1) > > redirect_to '/board' > end > > def edit > @post = Post.find(params[:id]) > end > def update > @post = Post.find(params[:id]) > @post.title = params[:title] > @post.content = params[:content] > @post.save > > redirect_to '/board' > end > def delete > @post = Post.find(params[:id]) > @post.destroy > > redirect_to '/board' > end > end > > > ---- edit.html.erb ----- > <form action="/update" method="post"> > <input name="authenticity_token" value="<%= form_authenticity_token %>" type="hidden"> > <input name="id" value="<%= @post.id %>" type="hidden"> > 제목 : > <input type="text" name="title" value="<%= @post.title %>"><br> > 내용 : > <input type="text" name="content" value="<%= @post.content %>"><br><br> > <input type="submit" value="Submit"> > </form> > >
웹 에디터 끝
링크 #1
링크 #2
파일 #1
파일첨부
파일 #2
파일첨부
자동등록방지
자동등록방지
숫자음성듣기
새로고침
자동등록방지 숫자를 순서대로 입력하세요.
취소
작성완료
Copyright ©
open.ajubang.com/mm
All rights reserved.
상단으로