diff options
| author | mo khan <mo@mokhan.ca> | 2013-07-26 19:38:52 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-07-26 19:38:52 -0600 |
| commit | 44571b3d8a35806cc3cbdd66ff28e35ebb42e45a (patch) | |
| tree | 5b04c7271e89617efb052c3762b8e85f3f493c27 /app | |
| parent | 12832c1fb4ed327abdbd62e5b882f93fd426c85f (diff) | |
fix creation controllers specs
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/creations_controller.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/controllers/creations_controller.rb b/app/controllers/creations_controller.rb index e944a0e1..d426ff2d 100644 --- a/app/controllers/creations_controller.rb +++ b/app/controllers/creations_controller.rb @@ -20,7 +20,7 @@ class CreationsController < ApplicationController end def create - @creation = current_user.creations.create(params[:creation]) + @creation = current_user.creations.create(creation_params) @creation.categories << Category.find(params[:category_id]) if params[:category_id] current_user.tag(@creation, :with => params[:creation_tags], :on => :tags) @@ -39,11 +39,11 @@ class CreationsController < ApplicationController @creation.categories << Category.find(params[:category_id]) if params[:category_id] current_user.tag(@creation, :with => params[:creation_tags], :on => :tags) - if @creation.update_attributes(params[:creation]) + if @creation.update_attributes(creation_params) redirect_to new_creation_photo_url(@creation) else flash[:error] = @creation.errors.full_messages - render :action => "edit" + render :edit end end @@ -55,4 +55,10 @@ class CreationsController < ApplicationController def mine @creations = current_user.creations.includes([:user]).page(params[:page]).per(12) end + + private + + def creation_params + params.require(:creation).permit(:name, :story, :is_restricted, :watermark) + end end |
