Sha256: 763988cc492dad834371fd455cfefa56cc4b549400c312eb09ec6d0fd421f111
Contents?: true
Size: 1.28 KB
Versions: 33
Compression:
Stored size: 1.28 KB
Contents
module ErpApp module Organizer class BaseController < ErpApp::ApplicationController layout nil before_filter :require_login def index @user = current_user @organizer = @user.organizer end def get_preferences user = current_user organizer = ::Organizer.find_by_user(user) render :inline => "{\"success\":true, \"preferences\":#{organizer.preferences.to_json(:include => [:preference_type, :preference_option])}}" end def setup_preferences user = current_user organizer = ::Organizer.find_by_user(user) render :inline => "{\"success\":true, \"preference_types\":#{organizer.preference_types.to_json(:include => :preference_options)}}" end def update_preferences user = current_user organizer = ::Organizer.find_by_user(user) params.each do |k,v| organizer.set_preference(k, v) unless (k.to_s == 'action' or k.to_s == 'controller' or k.to_s == 'authenticity_token') end organizer.save render :inline => "{\"success\":true, \"preferences\":#{organizer.preferences.to_json(:include => [:preference_type, :preference_option])}}" end end#BaseController end#Organizer end#ErpApp
Version data entries
33 entries across 33 versions & 1 rubygems