Sha256: 422f1cfe330e81d956bf73188d785d552c17849be561880f891c9d75d68f992a
Contents?: true
Size: 741 Bytes
Versions: 5
Compression:
Stored size: 741 Bytes
Contents
class E9Crm::MenuOptionsController < E9Crm::ResourcesController defaults :resource_class => MenuOption include E9Rails::Controllers::Sortable self.should_paginate_index = false has_scope :options_for, :as => :key, :only => :index # NOTE The reason this is set in a filter instead of just a default scope value # is that it is used in the index view to add the key param to the new # resource link # before_filter :ensure_default_fetch_key, :only => :index def create create! { collection_path(:key => resource.key) } end def update update! { collection_path(:key => resource.key) } end protected def ensure_default_fetch_key params[:key] ||= MenuOption::KEYS.sort.first end end
Version data entries
5 entries across 5 versions & 1 rubygems