Skip to content

Commit

Permalink
Merge pull request #68 from sergii/cleanup_actions
Browse files Browse the repository at this point in the history
Clean up actions
  • Loading branch information
jrgifford committed Feb 11, 2013
2 parents 5f81fb8 + aa2ffdd commit 3019dd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
9 changes: 4 additions & 5 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ def index
def create
@activity = Channel.find(params[:channel_id]).activities.build(params[:activity])
@activity.user_id = current_user.id if @activity.action == "message"
if @activity.save
respond_to do |format|

respond_to do |format|
if @activity.save
format.json { render :json => @activity, :status => :created }
end
else
respond_to do |format|
else
format.json { render :json => @activity.errors, :status => :unprocessable_entity }
end
end
Expand Down
16 changes: 6 additions & 10 deletions app/controllers/channels_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ def index

def create
@channel = Channel.new(params[:channel])
if @channel.save
respond_to do |format|
respond_to do |format|
if @channel.save
format.json { render :json => @channel, :status => :created }
end
else
respond_to do |format|
else
format.json { render :json => @channel.errors, :status => :unprocessable_entity }
end
end
Expand All @@ -46,12 +44,10 @@ def show

def update
@channel = Channel.find(params[:id])
if @channel.update_attributes(params[:channel])
respond_to do |format|
respond_to do |format|
if @channel.update_attributes(params[:channel])
format.json { render :json => @channel, :status => :ok }
end
else
respond_to do |format|
else
format.json { render :json => @channel.errors, :status => :unprocessable_entity }
end
end
Expand Down

0 comments on commit 3019dd2

Please sign in to comment.