Class: Admin::Blog::BlogsController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::Blog::BlogsController
- Defined in:
- app/controllers/admin/blog/blogs_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/admin/blog/blogs_controller.rb', line 18 def create @blog.save! flash[:success] = 'Blog created' redirect_to :action => :edit, :id => @blog rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to create Blog' render :action => :new end |
#destroy ⇒ Object
36 37 38 39 40 |
# File 'app/controllers/admin/blog/blogs_controller.rb', line 36 def destroy @blog.destroy flash[:success] = 'Blog deleted' redirect_to :action => :index end |
#edit ⇒ Object
14 15 16 |
# File 'app/controllers/admin/blog/blogs_controller.rb', line 14 def edit render end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/admin/blog/blogs_controller.rb', line 6 def index @blogs = @site.blogs.page(params[:page]) end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/admin/blog/blogs_controller.rb', line 10 def new render end |
#update ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/admin/blog/blogs_controller.rb', line 27 def update @blog.update_attributes!(blog_params) flash[:success] = 'Blog updated' redirect_to :action => :edit, :id => @blog rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to update Blog' render :action => :edit end |