Sha256: 8aa81c1989830236992c12fb5762fd6c3029e7f53562c7cf7a847dbf039ad2fd

Contents?: true

Size: 482 Bytes

Versions: 2

Compression:

Stored size: 482 Bytes

Contents

class MainController < Ramaze::Controller
  def index
    @entries = Entry.order(:created.DESC).all
  end

  def delete id
    entry = Entry[id]
    entry.delete
    redirect :/
  end

  def edit id
    @entry = Entry[id]
    redirect_referrer unless @entry
  end

  def create
    Entry.add(*request[:title, :content])
    redirect :/
  end

  def save
    redirect_referer unless  entry = Entry[request[:id]]
    entry.update(*request[:title, :content])
    redirect :/
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-0.3.5 examples/blog/src/controller.rb
ramaze-0.3.0 examples/blog/src/controller.rb