This file contains 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
#!/usr/bin/env ruby -w | |
# This should be run through './script/runner' | |
options = YAML.load($stdin.read) | |
demo = Demo.find(options[:demo]) | |
runner = Outback::Runner.new | |
runner.manager = demo.manager |
This file contains 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
throw :halt, Proc.new { |controller| | |
@user = params[:login] | |
render(:index_not_logged_in) | |
} if !current_user |
This file contains 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
MODEL: | |
class Gallery | |
include DataMapper::Resource | |
belongs_to :user | |
has n, :photos | |
def thumbnail | |
"1" | |
end |
This file contains 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
Merb::Router.prepare do |r| | |
#Merbauth routes is broken (capture is depricated) | |
slice(:MerbAuth, :path => "", :default_routes => false) | |
# This is the default route for /:controller/:action/:id | |
# This is fine for most cases. If you're heavily using resource-based | |
# routes, you may want to comment/remove this line to prevent | |
# clients from calling your create or destroy actions with a GET | |
default_routes | |
This file contains 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 | |
This file contains 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 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 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 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); |
OlderNewer