Hola. I’m super-new to actually doing things in rails and with ruby, so
pardon me if this is an easy question to everyone else.
I’m making a web app, and at this time am designing the news/blog
portion of it. I have a controller (posts) and a model (post) designed
to coordinate this. I started out with a basic scaffold and went from
there. At this point, I’m trying to get rails to print “Updated by
author on 1/1/07 at 3:45PM” if the updated_at time is different than the
created_at time. Here’s my code:
<% for post in @posts.reverse %>
<%= link_to post.title, {:action => 'show', :id => post}, {:class => 'posttitle'} %> <%= link_to 'Edit',{ :action => 'edit', :id => post }, { :class => 'postedit' } %> <%= link_to(image_tag('destroypost.png'), {:action => 'destroy', :id => post}, :confirm => 'Are you sure?', :method => :post)%>
However, that string never shows up, and even weirder is that in the
default scaffold code, the updated_at and created_at values are the same
for every row. For the record, the default scaffold code is this:
<%= column.human_name %> | <% end %>|||
---|---|---|---|
<%=h post.send(column.name) %> | <% end %><%= link_to 'Show', :action => 'show', :id => post %> | <%= link_to 'Edit', :action => 'edit', :id => post %> | <%= link_to 'Destroy', { :action => 'destroy', :id => post }, :confirm => 'Are you sure?', :method => :post %> |
Any insight? Tips?