Puts just work on Controllers

Well, there are a few different ways to debug your app. What are you trying to find out?

In the model you can put:

class ModelName < ActiveRecord::Base   puts caller

.. .. end

That will give you the call stack everytime the model is hit.

If you want to debug params within your views you can place:

<%= debug params %>

Which will list all of the params in your views...

The list goes on and on..

What do you need to check?

It is just I want to see objects attributes I have from my model classes in the output, this is why I do the "puts" or "p", but it does not work. For example, I have a SearchEngine class, I have a def search() function that returs some results, and I want to see these results before sending them to the controller...

Älphä Blüë wrote:

You should debug through test parameters. Here's a site link to help:

Ok, I will take a look to these ways for debug. However, I still don't understand why my "puts" don't work. My non-Active record models are not in the app/model directory, but in an app/engine directory (is someone else work), can be this the problem? Or can be something related with jruby?

Älphä Blüë wrote:

Where are you looking for the output of the controller puts? Assuming that you are running your Rails test server using script/server then that information is displayed on the server console.

Ok, I will take a look to these ways for debug. However, I still don't understand why my "puts" don't work. My non-Active record models are not in the app/model directory, but in an app/engine directory (is someone else work), can be this the problem?

Where are you looking for the output of the controller puts? Assuming that you are running your Rails test server using script/server then that information is displayed on the server console.

Damaris Fuentes wrote:

Taking a look through Google I found that some people have the same problem, but most of them because they have changed from Webrick to Mongrel. Apparently, console with mongrel does not show the "puts" messages. However, I am working with webrick.

I'm getting the same issue, and I'm using lightppd. Way back I had some simple output to console type of thing, and I'm sure at the time I used print. That would have been on webrick back then.

I'm going to follow this thread as I'd like to know what the trick is. I fI find out before you, I'll post back.