Skip to content

Instantly share code, notes, and snippets.

require "bureaucrat/quickfields"
module DesignDetailsFields
def self.included(base)
base.class_eval do
text :design_description, :label => "Description"
end
end
require 'bureaucrat/formsets'
class QuoteItemForm < Bureaucrat::Forms::Form
extend Bureaucrat::Quickfields
string :id, :required => false
hide :id
string :description
integer :unit_price
integer :quantity, :required => false
# GET/DELETE /projects/:id/quotes/:quote_id/delete
def destroy
@project = Project.find(params[:id])
raise Rango::NotFound unless @project
@quote = Quote.first(:id => params[:id], :id => params[:quote_id])
raise Rango::NotFound unless @quote
if request.delete?
@quote.destroy
flash.notice = "Quote has been successfully deleted."
redirect url(:quotes, :id => @project.id)
Rango::Router.app = Usher::Interface.for(:rack) do
get("/login").to(Ark::Sessions.dispatcher(:new)).name(:login)
post("/login").to(Ark::Sessions.dispatcher(:create)).name(:perform_login)
post("/unauthenticated").to(Ark::Sessions.dispatcher(:unauthenticated))
get("/logout").to(Ark::Sessions.dispatcher(:destroy)).name(:logout)
get("/register").to(Ark::Users.dispatcher(:new)).name(:register)
post("/register").to(Ark::Users.dispatcher(:create)).name(:create_user)
get("/users").to(Ark::Users.dispatcher(:index)).name(:users)
= form :login do
= fieldset :credentials, "Log in" do
= text :username
= text :password
# Dependencies are generated using a strict version,
# Don't forget to edit the dependency versions when upgrading.
merb_gems_version = "1.1.0.pre"
dm_gems_version = "~> 0.10"
do_gems_version = "~> 0.10"
# If you did disable json for Merb, comment out this line.
# Don't use json gem version lower than 1.1.7! Older version have a security bug
require 'bcrypt'
module Ark
module Mixins
module BCryptUser
def self.included(base)
base.class_eval do
attr_accessor :password, :password_confirmation
before_save :encrypt_password
- extends "base.html"
- block(:nav) do
%ul
%li= link_to "Dashboard", resource(:guns)
%li= link_to "Settings", resource(:user, :edit)
%li= link_to "Sign Out", url(:logout)
- extend_block(:content) do
%section#userbar
Merb::Router::Behavior.class_eval do
def add_resource(*key)
register_resource(*key)
end
end
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
identify(User => :id) do
# encoding: utf-8
# http://wiki.github.com/botanicus/rango/controllers
require "rango/helpers"
require "rango/controller"
require "rango/mixins/rendering"
module Ark
class Application < Rango::Controller