1 class UserPreferenceController < ApplicationController
2 before_filter :authorize
6 doc = OSM::API.new.get_xml_doc
8 prefs = @user.preferences
10 el1 = XML::Node.new 'preferences'
13 el1 << pref.to_xml_node
17 render :text => doc.to_s, :content_type => "text/xml"
24 p.string = request.raw_post
31 doc.find('//preferences/preference').each do |pt|
32 pref = UserPreference.new
34 unless keyhash[pt['k']].nil? # already have that key
35 render :text => 'OH NOES! CAN HAS UNIQUE KEYS?', :status => :not_acceptable
43 pref.user_id = @user.id
48 render :text => 'Too many preferences', :status => :request_entity_too_large
52 # kill the existing ones
53 UserPreference.delete_all(['user_id = ?', @user.id])
60 rescue Exception => ex
61 render :text => 'OH NOES! FAIL!: ' + ex.to_s, :status => :internal_server_error
65 render :nothing => true