Class: Zencms::Backend::PostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/zencms/backend/posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
# File 'app/controllers/zencms/backend/posts_controller.rb', line 21

def create
  @post = build_resource
  @post.user = current_user
  create! do |success, failure|
    success.html{ redirect_to post_path(@post) }
    failure.html{ render action: "new" }
  end
end

#updateObject

before_filter :authenticate_user! load_and_authorize_resource



14
15
16
17
18
19
# File 'app/controllers/zencms/backend/posts_controller.rb', line 14

def update
  update! do |success, failure|
    success.html{ redirect_to post_path(resource) }
    failure.html{ render action: "edit" }
  end 
end