---
title: "在Rails中使用Pry"
author: "biyeah"
date: "2012-02-07T06:43:55Z"
tags: []
categories: ["Web前端"]
slug: "rails-pry"
draft: false
lastmod: "2012-02-07T06:43:55Z"
id: 1395774
url: "https://biyeah.iteye.com/blog/1395774"
---

Pry可看成是IRB的加强版。支持语法高亮等特点。
1、在Gemfile中添加：

> group :development do
> 	gem 'pry'
> end

运行bundle install。
２、在config/environments/development.r文件最后面添加：

> silence_warnings do
>   require "pry"
>   IRB = Pry
> end

保存即可。
运行rails console进入pry终端。
pry项目地址：<https://github.com/pry/pry>