class Admin::PreferencesController < AdminController layout 'admin' def index @preferences = Preference.sys(_sid).all end def show @preference = Preference.find_sid_id(_sid, params[:id]) end def new @preference = Preference.new end def create @preference = Preference.new(params[:preference]) @preference.system_id = _sid if @preference.save redirect_to [:admin, @preference], :notice => "Successfully created preference." else render :action => 'new' end end def edit @preference = Preference.find_sid_id(_sid, params[:id]) end def update @preference = Preference.find_sid_id(_sid, params[:id]) if @preference.update_attributes(params[:preference]) redirect_to [:admin, @preference], :notice => "Successfully updated preference." else render :action => 'edit' end end def destroy @preference = Preference.find_sid_id(_sid,params[:id]) @preference.destroy redirect_to admin_preferences_url, :notice => "Successfully destroyed preference." end end