annoying bug with InheritedResources, engine and custom actions
This commit is contained in:
parent
486f86f366
commit
6096d18689
@ -2,7 +2,7 @@ module Admin
|
||||
class BaseController < InheritedResources::Base
|
||||
|
||||
include Locomotive::Routing::SiteDispatcher
|
||||
|
||||
|
||||
layout 'admin/application'
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
1
doc/TODO
1
doc/TODO
@ -3,6 +3,7 @@ BOARD:
|
||||
- refactor slugify method (use parameterize + create a module)
|
||||
- send email when new content added thru api
|
||||
- publish event when saving form in ajax (for instance, in order to update account name or site name)
|
||||
- switch to list (theme assets / assets ?). delete all in once (with checkbox) or see details (updated_at, size, ...etc)
|
||||
|
||||
BACKLOG:
|
||||
|
||||
|
@ -11,9 +11,6 @@ require 'locomotive/inherited_resources'
|
||||
require 'locomotive/admin_responder'
|
||||
|
||||
require 'redcloth'
|
||||
require 'inherited_resources'
|
||||
require 'inherited_resources/responder'
|
||||
require 'inherited_resources/actions' # required otherwise actions won't be included in Admin base controller
|
||||
require 'mongo_session_store/mongoid'
|
||||
|
||||
module Locomotive
|
||||
|
@ -1,7 +1,11 @@
|
||||
require 'inherited_resources'
|
||||
require 'inherited_resources/actions'
|
||||
require 'inherited_resources/responder'
|
||||
|
||||
module InheritedResources
|
||||
# redirect to edit_resource_url instead of resource_url
|
||||
module Actions
|
||||
|
||||
|
||||
def create(options={}, &block)
|
||||
object = build_resource
|
||||
|
||||
@ -24,19 +28,19 @@ module InheritedResources
|
||||
respond_with_dual_blocks(object, options, &block)
|
||||
end
|
||||
alias :update! :update
|
||||
|
||||
|
||||
# DELETE /resources/1
|
||||
def destroy(options={}, &block)
|
||||
object = resource
|
||||
options[:location] ||= collection_url rescue nil
|
||||
|
||||
destroy_resource(object)
|
||||
|
||||
|
||||
options[:alert] = object.errors.full_messages.first # display the first error if present
|
||||
|
||||
|
||||
respond_with_dual_blocks(object, options, &block)
|
||||
end
|
||||
alias :destroy! :destroy
|
||||
|
||||
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user