rails console 里面没有全部显示数据库里面的数据。
mysql> select * from pages;
+----+------------+--------------+-----------+----------+---------+---------------------+---------------------+
| id | subject_id | name | permalink | position | visible | created_at | updated_at |
+----+------------+--------------+-----------+----------+---------+---------------------+---------------------+
| 1 | 1 | First Page | 0 | 1 | 0 | 2016-04-16 11:10:52 | 2016-04-16 11:10:52 |
| 2 | NULL | Seconde Page | 0 | 2 | 0 | 2016-04-17 09:54:04 | 2016-04-17 09:54:04 |
| 3 | NULL | Third Page | 0 | 2 | 1 | 2016-04-17 06:32:04 | 2016-04-17 06:32:04 |
| 4 | NULL | Forth Page | 0 | 4 | 1 | 2016-04-17 06:33:18 | 2016-04-17 06:33:18 |
| 5 | NULL | Fifth Page | 0 | 5 | 1 | 2016-04-17 14:35:53 | 2016-04-17 14:35:53 |
| 6 | NULL | Sixth Page | 6 | 6 | 0 | 2016-04-18 14:33:22 | 2016-04-18 14:33:22 |
| 7 | NULL | Seventh Page | 7 | 7 | 0 | 2016-04-18 14:35:22 | 2016-04-18 14:35:22 |
| 8 | NULL | Seventh Page | 7 | 7 | 0 | 2016-04-18 14:41:50 | 2016-04-18 14:41:50 |
| 9 | NULL | Seventh Page | 7 | 7 | 0 | 2016-04-18 14:41:57 | 2016-04-18 14:41:57 |
| 10 | NULL | p10s | 7 | 7 | 0 | 2016-04-18 14:41:58 | 2016-04-18 07:01:24 |
| 11 | 23 | page1 | 1 | 0 | 0 | 2016-04-28 07:29:29 | 2016-04-28 07:29:29 |
| 12 | 23 | k | 0 | 0 | 0 | 2016-04-28 14:07:42 | 2016-04-28 14:07:42 |
| 13 | 23 | new page | 3 | 3 | 0 | 2016-04-28 14:46:31 | 2016-04-28 14:46:31 |
| 14 | NULL | page1 | 10 | 1 | 0 | 2016-04-28 14:50:51 | 2016-04-28 14:50:51 |
+----+------------+--------------+-----------+----------+---------+---------------------+---------------------+
14 rows in set (0.00 sec)
irb(main):001:0> Page.all
Page Load (0.5ms) SELECT pages
.* FROM pages
=> #<ActiveRecord::Relation [#<Page id: 1, subject_id: 1, name: "First Page", permalink: 0, position: 1, visible: false, created_at: "2016-04-16 03:10:52", updated_at: "2016-04-16 03:10:52">, #<Page id: 2, subject_id: nil, name: "Seconde Page", permalink: 0, position: 2, visible: false, created_at: "2016-04-17 01:54:04", updated_at: "2016-04-17 01:54:04">, #<Page id: 3, subject_id: nil, name: "Third Page", permalink: 0, position: 2, visible: true, created_at: "2016-04-16 22:32:04", updated_at: "2016-04-16 22:32:04">, #<Page id: 4, subject_id: nil, name: "Forth Page", permalink: 0, position: 4, visible: true, created_at: "2016-04-16 22:33:18", updated_at: "2016-04-16 22:33:18">, #<Page id: 5, subject_id: nil, name: "Fifth Page", permalink: 0, position: 5, visible: true, created_at: "2016-04-17 06:35:53", updated_at: "2016-04-17 06:35:53">, #<Page id: 6, subject_id: nil, name: "Sixth Page", permalink: 6, position: 6, visible: false, created_at: "2016-04-18 06:33:22", updated_at: "2016-04-18 06:33:22">, #<Page id: 7, subject_id: nil, name: "Seventh Page", permalink: 7, position: 7, visible: false, created_at: "2016-04-18 06:35:22", updated_at: "2016-04-18 06:35:22">, #<Page id: 8, subject_id: nil, name: "Seventh Page", permalink: 7, position: 7, visible: false, created_at: "2016-04-18 06:41:50", updated_at: "2016-04-18 06:41:50">, #<Page id: 9, subject_id: nil, name: "Seventh Page", permalink: 7, position: 7, visible: false, created_at: "2016-04-18 06:41:57", updated_at: "2016-04-18 06:41:57">, #<Page id: 10, subject_id: nil, name: "p10s", permalink: 7, position: 7, visible: false, created_at: "2016-04-18 06:41:58", updated_at: "2016-04-17 23:01:24">, ...]>
rails c 中 展示数据库条数默认是10 。后面的省略号看到了没。
如果想看有多少条的话 可以使用Page.count