Reputation: 1332
Simple question.
Is there a way to see all your data that your receive from a query in Rails?
Example:
@persons = Person.find(:all)
Is there a way to see all data from @person?
Upvotes: 0
Views: 108
Reputation: 42207
require 'pp'
pp @persons = Person.find(:all)
or
puts @persons = Person.find(:all).inspect
Also look at the gem unroller, it's awesome at debugging, look at
http://unroller.rubyforge.org/
for an example with debugging ActiveRecord
Upvotes: 2
Reputation: 989
open your shell. type in:
rails c
and then
p = Person.find(:all)
and you should see all data. the rails console helped me a lot of times to inspect data.
or
what do you mean with "joined data"? if you just want to see the data you could use a database browser like SQL Database Browser for sqlite
Upvotes: 0
Reputation: 156
Try this:
pp @persons
Also you can install this awesome gem: https://github.com/michaeldv/awesome_print and use ap instead. In that case:
ap @persons
Upvotes: 0