Sha256: f6e688a31927a072573441949bb1c090c5dda8b205190b0b455211de94df09e3

Contents?: true

Size: 826 Bytes

Versions: 40

Compression:

Stored size: 826 Bytes

Contents

class Admin::BlogsController < ApplicationController

  before_filter :authenticate_user! if Object.const_defined?('Devise')
  before_filter :scope_blog, :except => [:create]

  def index
  end

  def show
  end

  def new
  end

  def create
    @blog = Blog.new(params[:blog])
    if @blog.save
      flash[:notice] = 'Successfully set up the blog.'
      redirect_to admin_blog_path(@blog)
    else
      render :action => 'new'
    end
  end

  def edit
  end

  def update
    if @blog.update_attributes(params[:blog])
      flash[:notice] = 'Successfully modified the blog.'
      redirect_to admin_blog_path(@blog)
    else
      render :action => 'edit'
    end
  end

  private

  def scope_blog
    if params[:id]
      @blog = Blog.find(params[:id])
    else
      @blog = Blog.first || Blog.new
    end
  end

end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
blog_logic-1.2.2 app/controllers/admin/blogs_controller.rb
blog_logic-1.2.1 app/controllers/admin/blogs_controller.rb
blog_logic-1.2.0 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.9 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.8 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.7 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.6 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.5 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.4 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.3 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.2 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.1 app/controllers/admin/blogs_controller.rb
blog_logic-1.1.0 app/controllers/admin/blogs_controller.rb
blog_logic-1.0.0 app/controllers/admin/blogs_controller.rb
blog_logic-0.7.7 app/controllers/admin/blogs_controller.rb
blog_logic-0.7.6 app/controllers/admin/blogs_controller.rb
blog_logic-0.7.5 app/controllers/admin/blogs_controller.rb
blog_logic-0.7.4 app/controllers/admin/blogs_controller.rb
blog_logic-0.7.3 app/controllers/admin/blogs_controller.rb
blog_logic-0.7.2 app/controllers/admin/blogs_controller.rb