bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
bundle install
Showing posts with label Ruby. Show all posts
Showing posts with label Ruby. Show all posts
Sunday, November 1, 2015
Thursday, October 22, 2015
Ruby 다중라인 주석달기
Ruby는 파이썬과 비슷해서 #는 한라인 주석달기이다.
그런데 다중라인 주석달기는 =begin ~ =end인데 특이한점이 무조건 그 라인에서 첫번째 글자부터 시작해야 된다.
=앞에 스페이스나 탭이 들어가면 안된다.
그런데 다중라인 주석달기는 =begin ~ =end인데 특이한점이 무조건 그 라인에서 첫번째 글자부터 시작해야 된다.
=앞에 스페이스나 탭이 들어가면 안된다.
Tuesday, October 13, 2015
Ruby On Rails에서 로그 출력 하는 방법
콘솔용 Ruby에서는 print와 puts를 사용하면 화면에 문자열을 찍을 수 있는데 Ruby On Rails는 웹 프레임워크라서 print/puts를 사용하면 문자열이 HTML로 출력이 된다.
그래서 다음과 같이 출력하면 로그 파일에 안전하게 로그가 출력이 된다.
Rails.logger.debug "(문자열)"
문자열은 log/development.log, production.log에 출력이 된다.
debug대신에 info, warn등을 사용할수 있는데 이것은 다음과 같은 환경설정을 따른다.
config/environments/development.rb, production.rb에서 다음과 같이 지정한다.
config.log_level = :debug
그래서 다음과 같이 출력하면 로그 파일에 안전하게 로그가 출력이 된다.
Rails.logger.debug "(문자열)"
문자열은 log/development.log, production.log에 출력이 된다.
debug대신에 info, warn등을 사용할수 있는데 이것은 다음과 같은 환경설정을 따른다.
config/environments/development.rb, production.rb에서 다음과 같이 지정한다.
config.log_level = :debug
Saturday, October 10, 2015
Ruby cannot load such file -- 2.2/pg_ext (LoadError) 에러 해결 방법
윈도우에 Ruby on Rails를 설치하여 빌드하여 실행 하려고 하는데(rails s) 다음과 같은 에러가 발생했다.
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `require': cannot load such file -- 2.2/pg_ext (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `rescue in <top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:3:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from C:/git/amanda-api/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
이를 해결하는 방법은 다음과 같다.
gem instasll pg --pre
gem list pg
확인결과 최신버전은 0.18.3이다.
그럼 Gemfile, Gemfile.lock에서 pg의 버전을 0.18.3으로 변경하면 해결 된다.
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `require': cannot load such file -- 2.2/pg_ext (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `rescue in <top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:3:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from C:/git/amanda-api/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
이를 해결하는 방법은 다음과 같다.
gem instasll pg --pre
gem list pg
확인결과 최신버전은 0.18.3이다.
그럼 Gemfile, Gemfile.lock에서 pg의 버전을 0.18.3으로 변경하면 해결 된다.
Monday, October 5, 2015
RubyMine 7 스타트업 회사에서 싸게 구매하는 법(Startup discount)
https://www.jetbrains.com/shop/eform/startup
최근에 Ruby On Rails로 된 서버를 개발하다가 개발툴인 RubyMine을 구매하려고 하다가 보니 다음과 같은 공식 사이트에서 스타트업을 위한 할인 캠페인을 발견했다.
다음과 같이 3년이하, 10인이하 사업장에서 할인을 받을수 있다. 할인 폼에 정보를 입력하면 2-3일정도의 심사 과정을 거친후에 메일로 그 결과가 발송된다.
최근에 Ruby On Rails로 된 서버를 개발하다가 개발툴인 RubyMine을 구매하려고 하다가 보니 다음과 같은 공식 사이트에서 스타트업을 위한 할인 캠페인을 발견했다.
다음과 같이 3년이하, 10인이하 사업장에서 할인을 받을수 있다. 할인 폼에 정보를 입력하면 2-3일정도의 심사 과정을 거친후에 메일로 그 결과가 발송된다.
This discount is available to any company that meets all the following requirements:
- Is privately held,
- Has been in business for no more than 3 years,
- Has no more than 10 employees,
- Is engaged in development of a software-based product or service, and
- Is an established business with a website and/or existing public references on the Internet.
If your company meets these criteria, apply for your discount now.
After your application is approved, your startup discount will be available for one or more purchases for 12 months
Subscribe to:
Posts (Atom)