Sha256: ae06ab57db9e17ac9f3b2aee9b5b121bd4167da7a228afac2d6cbfe5fe7f6b80
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 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 => !request.xhr? } 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
6 entries across 6 versions & 2 rubygems