http://blog.naver.com/PostView.nhn?blogId=dg_667&logNo=220616006452&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView
여기에 있는 것처럼 Cloud9 에 가입해서 루비온레일즈 로 게시판을 만들어 보았다.
비지니스 로직이 들어갈 모델관련 파일은
rails g model 모델명 라는 식으로 생성한다.
그러면 db/migrate/ 밑에 테이블 정의하는
t.string:cell2
t.text:comment
처럼 추가한다.
그리고 나서
rake db:migrate 를 실행해서 실제 디비에 테이블이 생성되도록한다.
이제 게시판의 글목록,쓰기,보기,삭제 등을 구현해야 하는데,
일단
http://blog.naver.com/PostView.nhn?blogId=dg_667&logNo=220638145196&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView
이곳을 참고하여 본다.
현재 board_controller.rb 의 write,list,view,list, delete 메소드(def)에 아무것도 없는데 각각 채워넣어주면된다.
def list
@table1 = Table1.all
end
하고
list.html.erb에선
<%@table1.each do |tablecell|%>
<p><%=tablecell.cell1%></p>
<%end%>
하면 출력끝..오...
등록은
def register
if params[:cell1].present? && params[:cell2].present?
table1 = Table1.new
table1.cell1 = params[:cell1]
table1.cell2 = params[:cell2]
table1.save
else
puts "no data"
end
redirect_to action:"list"
end
function 을...왜 def 로 했을까...
def sipal(num1, num2)
return num1 + num2
end
이나..
function sipal(num1, num2)
return num1 + num2
end
이나...
좋은지 모르겠음..
2017년 9월 26일 화요일
Ruby On Rails - Cloud9 에서 테스트 개발 해보기
Related Posts:
Ruby On Rails - Tip and Trick https://www.slideshare.net/Scudelletti/ruby-tips-andtricks… Read More
루비와 레일스 웹서비스http://rorlab.org/websites… Read More
Ruby 50 가지 팁 링크https://gist.github.com/nacyot/7624036 알아두면 도움이 되는 55가지 루비 기법 루비도 공부했으니. 나중에 루비 쓸때 참고 … Read More
aws 에 ruby on rail 세팅하기http://psygotsky.blogspot.jp/2017/03/aws-ruby-on-rails.html… Read More
알아두면 도움이 되는 55가지 루비 기법https://gist.github.com/nacyot/7624036… Read More
0 comments:
댓글 쓰기