From cfa6ade998b49ba1eef1765cd4ae17d692608fbd Mon Sep 17 00:00:00 2001 From: Reyes Yang Date: Tue, 6 Mar 2012 10:42:58 +0800 Subject: [PATCH] Add attr_accessible to model --- app/models/article.rb | 3 +-- app/models/tag.rb | 1 + app/models/user.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index f384d74..9391314 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -1,5 +1,6 @@ # -*- encoding : utf-8 -*- class Article < ActiveRecord::Base + attr_accessible :title, :content, :tags_string, :english_title before_save :update_articles_count_on_tags_bf_save before_destroy :update_articles_count_on_tags_bf_destroy @@ -7,8 +8,6 @@ class Article < ActiveRecord::Base validates :english_title, :uniqueness => true has_and_belongs_to_many :tags - - attr_accessible :title, :content, :tags_string, :english_title self.per_page = 10 @@original_tags = nil diff --git a/app/models/tag.rb b/app/models/tag.rb index 84b4a4c..69d5976 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,5 +1,6 @@ # -*- encoding : utf-8 -*- class Tag < ActiveRecord::Base + attr_accessible :name default_scope :order => 'name' has_and_belongs_to_many :articles diff --git a/app/models/user.rb b/app/models/user.rb index cf6d32c..f122f6b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,6 +3,7 @@ class User < ActiveRecord::Base has_secure_password + attr_accessible :name, :password, :password_confirmation validates :name, :presence => true, :uniqueness => true validates :password_confirmation, :presence => true, :on => :create