This commit is contained in:
parent
cd73e4810a
commit
3452a81971
|
|
@ -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.' }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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' %>
|
||||
|
|
|
|||
Loading…
Reference in New Issue