Sha256: 0da89738743a9266b0a1d349b1c2ee0aea7ec3c9f977d2053bb632426c2bb59b
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 KB
Contents
class Admin::PrototypesController < Admin::BaseController resource_controller after_filter :set_habtm_associations, :only => [:create, :update] helper 'admin/product_properties' def available @prototypes = Prototype.all render :layout => false end def select load_object end new_action.response do |wants| wants.html {render :action => :new, :layout => false} end # redirect to index (instead of r_c default of show view) update.response do |wants| wants.html {redirect_to collection_url} end # redirect to index (instead of r_c default of show view) create.response do |wants| wants.html {redirect_to collection_url} end private def set_habtm_associations object.property_ids = params[:property][:id] if params[:property] object.option_type_ids = params[:option_type][:id] if params[:option_type] end def specified_rights(type) rights = [] key = "#{type}_ids".to_sym params[:permission][key] ||= [] params[:permission][key].each do |id| rights << type.classify.constantize.find(id) end rights end end
Version data entries
7 entries across 7 versions & 2 rubygems