This commit is contained in:
ahinz 2014-12-11 15:45:49 +01:00
parent cd73e4810a
commit 3452a81971
3 changed files with 12 additions and 20 deletions

View File

@ -26,7 +26,8 @@ class ArticlesController < ApplicationController
# POST /articles.json
def create
@article = Article.new(article_params)
@article.created_by = current_user.id
@article.updated_by = current_user.id
respond_to do |format|
if @article.save
format.html { redirect_to @article, notice: 'Article was successfully created.' }

View File

@ -5,12 +5,7 @@ class Article < ActiveRecord::Base
before_destroy :b_destroy
def b_create
self.created_by = current_user.id
self.updated_by = current_user.id
end
def b_update
self.updated_by = current_user.id
self.rate = 0.0
end
def b_destroy

View File

@ -11,8 +11,6 @@
<th><%= model_class.human_attribute_name(:rate) %></th>
<th><%= model_class.human_attribute_name(:active) %></th>
<th><%= model_class.human_attribute_name(:created_by) %></th>
<th><%= model_class.human_attribute_name(:updated_by) %></th>
<th><%= model_class.human_attribute_name(:created_at) %></th>
<th><%=t '.actions', :default => t("helpers.actions") %></th>
</tr>
</thead>
@ -24,9 +22,7 @@
<td><%= article.content %></td>
<td><%= article.rate %></td>
<td><%= article.active %></td>
<td><%= article.created_by %></td>
<td><%= article.updated_by %></td>
<td><%=l article.created_at %></td>
<td><%= article.created %></td>
<td>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_article_path(article), :class => 'btn btn-default btn-xs' %>