video id fix for channels

This commit is contained in:
Lee Lawlor 2015-02-13 08:47:12 -05:00
parent e25885a96e
commit 5ec4deb7fe

View File

@ -195,21 +195,17 @@ class ChannelsController < ApplicationController
# get the current user or find the user via their api key
@user = current_user || User.find_by_api_key(get_apikey)
@channel = @user.channels.find(params[:id])
@channel.assign_attributes(channel_params)
# make updating attributes easier for updates via api
params[:channel] = params if params[:channel].blank?
if @channel.valid?
@channel.save_tags(params[:tags][:name]) if params[:tags].present?
@channel.assign_attributes(channel_params)
@channel.set_windows
@channel.save
@channel.set_ranking
else
if !@channel.valid?
flash[:alert] = @channel.errors.full_messages.join(', ')
redirect_to channel_path(@channel.id, :anchor => "channelsettings") and return
end
@channel.save_tags(params[:tags][:name]) if params[:tags].present?
@channel.set_windows
@channel.save
@channel.set_ranking
flash[:notice] = t(:channel_update_success)
respond_to do |format|
format.json { render :json => @channel.to_json(Channel.private_options) }