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.4.15 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.14 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.13 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.12 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.11 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.10 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.9 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.8 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.7 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.6 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.5 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.4 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.3 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.2 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.1 app/controllers/admin/blogs_controller.rb
blog_logic-1.4.0 app/controllers/admin/blogs_controller.rb
blog_logic-1.3.1 app/controllers/admin/blogs_controller.rb
blog_logic-1.3.0 app/controllers/admin/blogs_controller.rb
blog_logic-1.2.4 app/controllers/admin/blogs_controller.rb
blog_logic-1.2.3 app/controllers/admin/blogs_controller.rb