Update for API change in CPK 7.x

This commit is contained in:
Tom Hughes 2014-05-28 00:44:26 +01:00
parent 6a198d47aa
commit dd81b09eba
2 changed files with 16 additions and 16 deletions

View file

@ -26,7 +26,7 @@ class UserPreferenceController < ApplicationController
##
# return the value for a single preference
def read_one
pref = UserPreference.find(@user.id, params[:preference_key])
pref = UserPreference.find([@user.id, params[:preference_key]])
render :text => pref.v.to_s, :content_type => "text/plain"
end
@ -69,7 +69,7 @@ class UserPreferenceController < ApplicationController
# update the value of a single preference
def update_one
begin
pref = UserPreference.find(@user.id, params[:preference_key])
pref = UserPreference.find([@user.id, params[:preference_key]])
rescue ActiveRecord::RecordNotFound
pref = UserPreference.new
pref.user = @user
@ -85,7 +85,7 @@ class UserPreferenceController < ApplicationController
##
# delete a single preference
def delete_one
UserPreference.find(@user.id, params[:preference_key]).delete
UserPreference.find([@user.id, params[:preference_key]]).delete
render :text => "", :content_type => "text/plain"
end