mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Show Rails Models With Pry as a rails til.
This commit is contained in:
@@ -185,6 +185,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
- [Select A Select By Selector](rails/select-a-select-by-selector.md)
|
- [Select A Select By Selector](rails/select-a-select-by-selector.md)
|
||||||
- [Select Value For SQL Counts](rails/select-value-for-sql-counts.md)
|
- [Select Value For SQL Counts](rails/select-value-for-sql-counts.md)
|
||||||
- [Show Pending Migrations](rails/show-pending-migrations.md)
|
- [Show Pending Migrations](rails/show-pending-migrations.md)
|
||||||
|
- [Show Rails Models With Pry](rails/show-rails-models-with-pry.md)
|
||||||
|
|
||||||
### ruby
|
### ruby
|
||||||
|
|
||||||
|
|||||||
23
rails/show-rails-models-with-pry.md
Normal file
23
rails/show-rails-models-with-pry.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Show Rails Models With Pry
|
||||||
|
|
||||||
|
With the [`pry-rails`](https://github.com/rweng/pry-rails) gem, you get some
|
||||||
|
extra goodies in the Rails console for your project. One of those goodies is
|
||||||
|
`show-models`, a command for printing out a list of all models in the rails
|
||||||
|
project. Add and bundle the `pry-rails` gem, run `rails c`, and then run
|
||||||
|
`show-models` to give it a go.
|
||||||
|
|
||||||
|
```
|
||||||
|
> show-models
|
||||||
|
Pokemon
|
||||||
|
id: integer
|
||||||
|
name: string
|
||||||
|
level: integer
|
||||||
|
pokemon_type: varchar
|
||||||
|
belongs_to Trainer
|
||||||
|
created_at: datetime
|
||||||
|
updated_at: datetime
|
||||||
|
Trainer
|
||||||
|
id: integer
|
||||||
|
name: string
|
||||||
|
has_many Pokemons
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user