Sha256: 188916b9409d0d08f873d73fe12e754d4ed16db473173953b6de1f166e76a4c8

Contents?: true

Size: 502 Bytes

Versions: 3

Compression:

Stored size: 502 Bytes

Contents

class MainController < Ramaze::Controller
  layout '/layout'

  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

3 entries across 3 versions & 2 rubygems

Version Path
clivecrous-ramaze-0.3.9.5 examples/blog/controller/main.rb
ramaze-0.3.9.1 examples/blog/controller/main.rb
ramaze-0.3.9 examples/blog/controller/main.rb