Skip to content

Instantly share code, notes, and snippets.

@julioprotzek
Last active December 28, 2015 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julioprotzek/7444165 to your computer and use it in GitHub Desktop.
Save julioprotzek/7444165 to your computer and use it in GitHub Desktop.
class Article < ActiveRecord::Base
validates :title, presence: true
end
class Category < ActiveRecord::Base
validates :name, presence: true
end
h1 Artigos
table.table.table-striped
thead
tr
th Título
th Publicado em
th
tbody
- @articles.order(published_at: :desc).order(:title).each do |article|
tr
td = article.title
td = l article.published_at
td
.btn-group.pull-right
= link_to 'Ver', article, class: 'btn btn-default btn-sm'
= link_to 'Editar', edit_article_path(article), class: 'btn btn-default btn-sm'
= link_to 'Excluir', article, :confirm => 'Tem certeza?', :method => :delete, class: 'btn btn-default btn-sm'
br
= link_to 'Criar Artigo', new_article_path, class: 'btn btn-primary'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment