본문 바로가기 메뉴 바로가기

덕's IT Story

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

덕's IT Story

검색하기 폼
  • 분류 전체보기 (198)
    • IT 이야기 (31)
      • 그 외 (15)
      • 대외활동 소식 (9)
      • 컴퓨터 지식 (7)
    • 클라우드&오픈스택 (8)
      • 클라우드 (2)
      • 오픈스택 (6)
    • 프로그래밍 (86)
      • C/C++ (1)
      • 자료구조&알고리즘 (11)
      • 다음API (6)
      • OpenCV (2)
      • RabbitMQ (6)
      • Git&GitHub (3)
      • Web (2)
      • 자바스크립트 (12)
      • Spring (7)
      • Java (36)
    • Ruby&Rails (21)
      • Rails (16)
      • Gem (5)
    • OS (20)
      • 리눅스&우분투 (12)
      • CentOS (5)
      • 안드로이드 (3)
    • 해킹&보안 (5)
      • 무선해킹 (2)
      • 시스템해킹 (3)
  • 방명록

Ruby&Rails/Rails (16)
[Rails] Redirect and Flash 문법

기본적인 문법 class PostsController < ApplicationControllerdef edit@post = Post.find(params[:id])if session[:user_id] != @post.user_idflash[:notice] = "Sorry, you can't edit this post"redirect_to post_pathendendend 대체가능한 문법class PostsController < ApplicationControllerdef edit@post = Post.find(params[:id])if session[:user_id] != @post.user_idredirect_to (post_path, notice: "Sorry, you can't edit this p..

Ruby&Rails/Rails 2015. 6. 24. 21:04
[Rails] validates 문법

기본 validates 문법 validates :name, presence: truevalidates :name, length: {mininum: 3} 대체가능 validates 문법validates :name,presence: true,length: {mininum: 3} 참고 : http://guides.rubyonrails.org/active_record_validations.html

Ruby&Rails/Rails 2015. 6. 24. 16:46
[Rails] CRUD의 Create & Update & Delete 문법

기본 Create 문법 t = User.newt.name = "Jinny"t.phone = "01012341234"t.save 대체가능 Create 문법1t. = User.new(name: "Jinny"phone: "01012341234") t.save 대체가능 Create 문법2t = User.create(name: "Jinny", phone: "01012341234") 기본 Update 문법 t = User.find(3)t.name = "Jinny"t.phone = "01012341234"t.save 대체가능 Update 문법1t = User.find(3)t.attributes = {name: "Jinny"phone: "01012341234"} t.save 대체가능 Update 문법2t = User...

Ruby&Rails/Rails 2015. 6. 24. 16:02
[Rails] 외부 fonts 경로 및 사용법

Rails 에서 외부 폰트의 위치 경로와 사용 시 path 입력 방법을 알아보겠습니다. 환경 : Ruby 2.0.0-p598 Rails 4.1 위의 그림과 같이 app - assets 하위에 기존의 images, javascripts, stylesheets 와 동일한 위치에 fonts 디렉터리를 생성해줍니다. 그리고 config/application.rb 에 다음과 같은 내용을 삽입해 줍니다. config.assets.paths

Ruby&Rails/Rails 2015. 1. 28. 14:01
[Rails] 이전 url로 redirect 하기

어떠한 Action을 취한 후 이전 URL로 돌아가는 경우는 흔히 있다. 예를들어 해당 게시글을 수정 혹은 삭제 후 다시 원래 URL로 돌아가는 것이 당연하다.이를 구현하기 위해서는 해당 Controller 에서 이전 URL을 저장하고 Action이 끝난 후 저장해둔 URL로 redirection 시켜주면 된다. 예를들어 해당 report 삭제 후 다시 url 로 돌아가는 것을 구현하고자 하면 destory action에 이전 url을 저장한다.store_location 은 private method 로 다음와 같다. 그리고 원하는 행동(예제에서는 해당 report 를 destroy 후) redirect_to 를 이용해 저장해둔 url로 redirection 시켜주면된다.

Ruby&Rails/Rails 2014. 8. 21. 00:35
[Rails] 파일/이미지 업로드 paperclip

Rails 4 에서 Paperclip 과 Image Magick 으로 파일 업로드 및 이미지 처리를 할 수 있습니다. Paperclip 을 이용한 프로필 사진 기능을 만들어보도록 하겠습니다. Requirements1. Ruby 버전 1.9.2 이상2. Rails 버전 3.0 이상3. ImageMagick 설치 1. ImageMagick 설치$ sudo apt-get install imagemagick$ sudo apt-get instal libmagickwand-dev 2. Paperclip gem 설치Gemfile 에 추가gem "paperclip", "~> 4.1"$ bundle install 3. User 모델에 컬럼추가$ rails g paperclip user avatar$ rake db:mig..

Ruby&Rails/Rails 2014. 8. 18. 11:20
[Rails] Active record - rake db 종류

Rails 3.2.12 버전 db:create creates the database for the current envdb:create:all creates the databases for all envsdb:drop drops the database for the current envdb:drop:all drops the databases for all envsdb:migrate runs migrations for the current env that have not run yetdb:migrate:up runs one specific migrationdb:migrate:down rolls back one specific migrationdb:migrate:status shows current migr..

Ruby&Rails/Rails 2014. 8. 16. 21:47
Ubuntu 에서 Ruby & Rails 설치하기

Ubuntu 에서 Ruby & Rails 설치하기 1. RVM 설치$ curl -sSL https://get.rvm.io | bash -s stable 2. RVM 실행$ rvm get stable 3. Ruby 설치에 필요한 패키지들 설치$ rvm requirements ("Command not found" 에러시)$ source ~/.rvm/scripts/rvm 4. 패키지 management 설치$ apt-get install libyaml-dev 5. RVM의 OpenSSL 환경변수 등록$ rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/usr 6. Rails 애플리케이션을 실행하기 위한 필요한 Gemset 설정rvm use 2.0.0@railstutorial..

Ruby&Rails/Rails 2014. 7. 10. 02:36
이전 1 2 다음
이전 다음
최근에 올라온 글
  • [책 리뷰] 자바 최적화 (Optimizing J⋯
  • Spring Webflux + JDBC(혹은 bl⋯
  • [macOS Mojave] Evernote (혹은⋯
  • spring-boot-starter-webflux⋯
TAG
  • IceHouse
  • codecademy
  • 다음지도
  • 다음지도 API
  • 이펙티브 자바
  • 클라우드 컴퓨팅
  • IT
  • 컴퓨터
  • install
  • CSS
  • 오픈스택
  • 티스토리 초대장
  • 리눅스
  • 다음
  • ruby on rails
  • javascript
  • 웹프로그래밍
  • html
  • ruby
  • Message Queue
  • 알고리즘
  • 자료구조
  • Rails
  • Java
  • 프로그래밍
  • rabbitmq
  • OpenStack
  • gem
  • 우분투
  • ubuntu
more
글 보관함
  • 2019/06 (1)
  • 2018/12 (2)
  • 2018/11 (2)
  • 2018/10 (1)
  • 2018/07 (2)
Total
695,667
Today
68
Yesterday
235

Copyright ⓒ 2018 kkd927. All rights reserved.

티스토리툴바