find_by_sql timestamp parameter

Stanislav Orlenko
Tue, 25 May 2010 08:29:03 -0000

Hi
In controller I have this query:

@price_stat = Price.find_by_sql("select id, cost, tour_id,
unix_timestamp(created_at) from prices")

when I try to display result''s created_at column I don''t have
any
results:

<% @price_stat.each do |p| %>
<%= p.created_at %>
<% end %>

result is empty

But if I try without unix_timestamp. ie:

@price_stat = Price.find_by_sql("select id, cost, tour_id, created_at
from prices")

It works fine. ( <%= p.created_at %> )

How I can get value of created_at column when using unix_timestamp?

Thanks in advance
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at