Last active
December 28, 2015 04:39
-
-
Save julioprotzek/7444165 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Article < ActiveRecord::Base | |
validates :title, presence: true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Category < ActiveRecord::Base | |
validates :name, presence: true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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