# What is the .rb.swap file for?

**URL:** <https://www.ruby-forum.com/t/what-is-the-rb-swap-file-for/115389>\
**Category:** Rails\
**Created:** [September 24, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/what-is-the-rb-swap-file-for/115389 "2007-09-24T20:11:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubynut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e8cbc/32.png) [@rubynut](https://www.ruby-forum.com/u/rubynut)\
**Post date:** [September 24, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/what-is-the-rb-swap-file-for/115389/1 "2007-09-24T20:11:08Z")

</div>

I generated a model “user” @ first.

then i added some code into the model.

after this, i generated a scaffold for model “user” and controller  
“admin”.

but i dont need the scaffold again so i “ruby script/destroy scaffold  
user admin”

the model and controller has been deleted.

i check out the app/model/ dir, their is a file called .rb.swap.

i need to recover the model user, but how?can i recover it from  
the .rb.swap file?what is the .rb.swap for?

---

<div class="post-metadata">

**Author:** ![rubynut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e8cbc/32.png) [@rubynut](https://www.ruby-forum.com/u/rubynut)\
**Post date:** [September 24, 2007, 8:58pm UTC](https://www.ruby-forum.com/t/what-is-the-rb-swap-file-for/115389/2 "2007-09-24T20:58:16Z")

</div>

Ruby N. wrote:

> the model and controller has been deleted.
> 
> i check out the app/model/ dir, their is a file called .rb.swap.
> 
> i need to recover the model user, but how?can i recover it from  
> the .rb.swap file?what is the .rb.swap for?
> 
> >

That was likely generated by whatever text editor you used to edit the  
model. vi? But it’s definitely not part of Rails and there’s nothing  
Rails can do with it.

–  
[http://www.5valleys.com/](http://www.5valleys.com/)  
[http://www.workingwithrails.com/person/8078](http://www.workingwithrails.com/person/8078)
