This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Segment | |
include DataMapper::Resource | |
property :id, Serial | |
property :title, String | |
has n, :products, :through => Resource | |
end | |
class Product | |
include DataMapper::Resource | |
property :id, Integer, :serial => true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/color_logger.rb | |
module Merb | |
class Logger | |
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white # 30 = black 31 = red 32 = green 33 = yellow blue 34 = 35 = magenta 36 = cyan 37 = white | |
Colors = Mash.new({ | |
:fatal => 31, | |
:error => 31, | |
:warn => 33, | |
:info => 38, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Admin | |
class Items < Application | |
# provides :xml, :yaml, :js | |
def index | |
@items = Item.all | |
display @items | |
end | |
def show(id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r.namespace :admin do |admin| | |
admin.resources :products | |
r.resources :product_lines do |product_line| | |
product_line.resources :products | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream localhost { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
# Set the max size for file uploads to 50Mb | |
client_max_body_size 80M; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="update"></div> | |
<a href="/test" id="test" rel="#update">test</a> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("#test").click(function(){ | |
event.preventDefault(); | |
$(this.rel).load(this.href); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Asset | |
include DataMapper::Resource | |
property :id, Integer, :serial => true | |
property :user_id, Integer, :nullable => false, :index => true | |
property :title, String | |
property :filename, String | |
property :content_type, String | |
property :size, Integer | |
property :created_at, DateTime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contacts < Application | |
# provides :xml, :yaml, :js | |
def index | |
@contacts = Contact.all | |
display @contacts | |
end | |
def show | |
@contact = Contact.get(params[:id]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/users/:id | |
/^/users(/|/index)?(\.:format)?$/ | |
/^/users/new$/ | |
/^/users/:id(\.:format)?$/ | |
/^/users/:id/edit$/ | |
/^/users/:id/delete$/ | |
/^/users/?(\.:format)?$/ | |
/^/users/:id(\.:format)?$/ | |
/^/users/:id(\.:format)?$/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Galleries < Application | |
before :login_required, :exclude => [:index, :show] | |
def index | |
# DM associations bug? | |
@galleries = User.first(:login => params[:login]).galleries | |
#@galleries = Gallery.all | |
display @galleries | |
end | |