Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up actions #68

Merged
merged 1 commit into from
Feb 11, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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