Added JSON support to user preferences
This commit is contained in:
parent
e751703983
commit
a67ff9c038
3 changed files with 13 additions and 1 deletions
|
@ -7,12 +7,17 @@ module Api
|
|||
|
||||
around_action :api_call_handle_error
|
||||
|
||||
before_action :set_request_formats
|
||||
|
||||
##
|
||||
# return all the preferences as an XML document
|
||||
def index
|
||||
@user_preferences = current_user.preferences
|
||||
|
||||
render :formats => [:xml]
|
||||
respond_to do |format|
|
||||
format.xml
|
||||
format.json
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
attrs = {
|
||||
"k" => user_preference.k,
|
||||
"v" => user_preference.v
|
||||
}
|
||||
|
||||
json.preference(attrs)
|
1
app/views/api/user_preferences/index.json.jbuilder
Normal file
1
app/views/api/user_preferences/index.json.jbuilder
Normal file
|
@ -0,0 +1 @@
|
|||
json.partial! @user_preferences
|
Loading…
Add table
Add a link
Reference in a new issue