Sha256: 8368186146691cc4ab171626cdba5c890ec9cf1966d4f7e190374bd9c1b1c487
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
import dubious.* import models.* class ContactsController < ApplicationController # GET /contacts def index @contacts = Contact.all.run render index_erb, main_erb end # GET /contacts/1 def show @contact = Contact.get(params.id) render show_erb, main_erb end # GET /contacts/new def new @contact = Contact.new render new_erb, main_erb end # GET /contacts/1/edit def edit @contact = Contact.get(params.id) render edit_erb, main_erb end # DELETE /contacts/1 def delete Contact.delete(Contact.get(params.id).key) redirect_to params.index end # POST /contacts def create Contact.new.update(params.for('contact')).save redirect_to params.index end # PUT /contacts/1 def update Contact.get(params.id).update(params.for('contact')).save redirect_to params.show end # render templates def_edb(index_erb, 'views/contacts/index.html.erb') def_edb(show_erb, 'views/contacts/show.html.erb') def_edb(new_erb, 'views/contacts/new.html.erb') def_edb(edit_erb, 'views/contacts/edit.html.erb') def_edb(main_erb, 'views/layouts/contacts.html.erb') end
Version data entries
3 entries across 3 versions & 1 rubygems