def index render :text => "Hello prosto z kontrolera" end
@post_pages, @posts = paginate :posts, :per_page => 10na:
@posts = Post.find(:all)
<div style="width:600px; margin:auto"> <h1>My cool blog</h1> <% for post in @posts %> <div> <%= link_to post.title, :action => 'show', :id => post %> <p> <%= post.body %> <p> <%= post.created_at.to_s %> <%= link_to 'Edit', :action => 'edit', :id => post %> <%= link_to 'Destroy', { :action => 'destroy', :id => post }, :confirm => 'Are you sure?', :method => :post %> <hr> </div> <% end %> </div> <%= link_to 'New post', :action => 'new' %>
<%= render :partial => "post", :collection => @posts.reverse %>
<%= render :partial => "post", :object => @post %>