Skip to content

Commit

Permalink
Strong parameters for State and TransitionEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Jun 25, 2014
1 parent 19e4e9c commit 3e5a42c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/controllers/admin/states_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ def collection
@q.sorts = "name asc" if @q.sorts.empty?
@states ||= @q.result(:distinct => true).page(params[:page]).per(20)
end

def permitted_params
params.permit(:state=> [:name, :machine_type, :user_id, :temp_comments, :description, :role_id])
end
end
5 changes: 5 additions & 0 deletions app/controllers/admin/transition_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ def collection
@q.sorts = "name asc" if @q.sorts.empty?
@transition_events ||= @q.result(:distinct => true).page(params[:page]).per(20)
end

def permitted_params
params.permit(:transition_event => [:name, :machine_type, :user_id, :description,
:source_state_ids => [], :target_state_id])
end
end
3 changes: 0 additions & 3 deletions app/models/state.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
class State < ActiveRecord::Base
extend ActiveHash::Associations::ActiveRecordExtensions


attr_accessible :name, :machine_type, :user_id, :temp_comments, :description, :role_id

#The user creating this state
belongs_to :user
# The role of the user assigned to perform a transition from this state
Expand Down
2 changes: 0 additions & 2 deletions app/models/transition_event.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class TransitionEvent < ActiveRecord::Base

attr_accessible :name, :machine_type, :user_id, :description, :source_state_ids, :target_state_id

#The user creating this transition_event
belongs_to :user
Expand Down

0 comments on commit 3e5a42c

Please sign in to comment.