Commit 04e227b7

mo khan <mo@mokhan.ca>
2013-07-27 00:35:01
remove protected_attributes and fix creation_tags_controller_spec
1 parent 6e1d9a7
app/models/admin_user.rb
@@ -5,5 +5,5 @@ class AdminUser < ActiveRecord::Base
          :recoverable, :rememberable, :trackable, :validatable
 
   # Setup accessible (or protected) attributes for your model
-  attr_accessible :email, :password, :password_confirmation, :remember_me
+  #attr_accessible :email, :password, :password_confirmation, :remember_me
 end
app/models/category.rb
@@ -1,6 +1,6 @@
 class Category < ActiveRecord::Base
   has_and_belongs_to_many :creations, :join_table => 'creations_categories'
-  attr_accessible :name, :slug
+  #attr_accessible :name, :slug
   #default_scope -> { order(:name) }
 
   def to_param
app/models/creation.rb
@@ -1,6 +1,6 @@
 class Creation < ActiveRecord::Base
   validates :name,  :presence => true
-  attr_accessible :user_id, :story, :name, :category_ids, :is_restricted, :watermark
+  #attr_accessible :user_id, :story, :name, :category_ids, :is_restricted, :watermark
   belongs_to :user, :counter_cache => true
   has_and_belongs_to_many :categories, -> { where unique: true }, :join_table => 'creations_categories', :autosave => true
   has_many :photos, -> { order :created_at }, :dependent => :destroy
app/models/favorite.rb
@@ -1,5 +1,5 @@
 class Favorite < ActiveRecord::Base
   belongs_to :user
   belongs_to :creation, :counter_cache => true
-  attr_accessible :user_id, :creation_id
+  #attr_accessible :user_id, :creation_id
 end
app/models/interest.rb
@@ -1,3 +1,3 @@
 class Interest < ActiveRecord::Base
-  attr_accessible :name
+  #attr_accessible :name
 end
app/models/photo.rb
@@ -1,5 +1,5 @@
 class Photo < ActiveRecord::Base
-  attr_accessible :is_primary, :creation, :image
+  #attr_accessible :is_primary, :creation, :image
   belongs_to :creation, :counter_cache => true
   validates :image,  :presence => true
   mount_uploader :image, PhotoUploader
app/models/tutorial.rb
@@ -1,5 +1,5 @@
 class Tutorial < ActiveRecord::Base
-  attr_accessible :description, :heading, :url, :image_url, :user_id, :author, :author_url
+  #attr_accessible :description, :heading, :url, :image_url, :user_id, :author, :author_url
   validates :url,  :presence => true
   belongs_to :user
   acts_as_taggable
app/models/user.rb
@@ -10,7 +10,7 @@ class User < ActiveRecord::Base
   validates :name,  :presence => true
   validates :website, :format => URI::regexp(%w(http https)), :allow_blank => true
   devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable
-  attr_accessible :name, :email, :website, :twitter, :facebook, :city, :latitude, :longitude, :password, :password_confirmation, :current_password, :remember_me, :interest_ids
+  #attr_accessible :name, :email, :website, :twitter, :facebook, :city, :latitude, :longitude, :password, :password_confirmation, :current_password, :remember_me, :interest_ids
   has_many :creations, :dependent => :destroy
   has_many :favorites, :dependent => :destroy
   has_many :tutorials, :dependent => :destroy
spec/controllers/creation_tags_controller_spec.rb
@@ -2,8 +2,8 @@ require "spec_helper"
 
 describe CreationTagsController do
   describe :index do
-    let(:cake) { FactoryGirl.create(:creation) }
-    let(:user) { FactoryGirl.create(:user) }
+    let(:cake) { create(:creation) }
+    let(:user) { create(:user) }
 
     before :each do
       user.tag(cake, :with => "cake", :on => :tags)
@@ -16,17 +16,16 @@ describe CreationTagsController do
     end
   end
   describe :show do
+    let(:user) { create(:user) }
     let(:tag) { "cake" }
-    let(:tagged_tutorial) { FactoryGirl.create(:tutorial) }
-    let(:untagged_tutorial) { FactoryGirl.create(:tutorial) }
-    let(:tagged_cake) { FactoryGirl.create(:creation, :photos_count => 1) }
-    let(:untagged_cake) { FactoryGirl.create(:creation) }
+    let(:tagged_tutorial) { create(:tutorial) }
+    let(:untagged_tutorial) { create(:tutorial) }
+    let(:tagged_cake) { create(:creation, :photos_count => 1) }
+    let(:untagged_cake) { create(:creation) }
 
     before :each do
-      tagged_tutorial.tag_list.add(tag)
-      tagged_tutorial.save
-      tagged_cake.tag_list.add(tag)
-      tagged_cake.save
+      user.tag(tagged_tutorial, :with => tag, :on => :tags)
+      user.tag(tagged_cake, :with => tag, :on => :tags)
       get :show, :id => tag
     end
 
Gemfile
@@ -30,7 +30,7 @@ gem 'airbrake'
 gem 'geocoder'
 gem 'pg'
 gem 'asset_sync'
-gem 'protected_attributes'
+#gem 'protected_attributes'
 
 group :development do
   gem 'capistrano'
Gemfile.lock
@@ -170,8 +170,6 @@ GEM
     orm_adapter (0.4.0)
     pg (0.16.0)
     polyglot (0.3.3)
-    protected_attributes (1.0.3)
-      activemodel (>= 4.0.0, < 5.0)
     rack (1.5.2)
     rack-mini-profiler (0.1.27)
       rack (>= 1.1.3)
@@ -299,7 +297,6 @@ DEPENDENCIES
   lol_dba
   newrelic_rpm
   pg
-  protected_attributes
   rack-mini-profiler
   rails (= 4.0.0)
   rmagick