Skip to content

Instantly share code, notes, and snippets.

Missing host to link to! Please provide :host parameter or set default_url_options[:host]
========================
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:473:in `url_for'
actionpack (3.0.3) lib/action_dispatch/routing/url_for.rb:131:in `url_for'
actionpack (3.0.3) lib/action_view/helpers/url_helper.rb:99:in `url_for'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:195:in `event_organizers_guide_url'
app/cells/events/member_header.html.erb:8:in `_app_cells_events_member_header_html_erb__15892402_26460970__143767651'
actionpack (3.0.3) lib/action_view/template.rb:135:in `block in render'
module UrlHelper
def generate_my_url(obj)
my_path({ :obj_id => obj.slug })
end
# [..]
end
@jmaicher
jmaicher / gist:838833
Created February 22, 2011 15:28
Querying embedded documents from embedded document
# ################
# Models
# ################
class Event
include Mongoid::Document
embeds_many :organizers, :class_name => "EventOrganizer"
end
@jmaicher
jmaicher / gist:1016933
Created June 9, 2011 15:13
Playing with streama
class Activity
include Mongoid::Document
include Streama::Activity
activity :follow_user do
actor :user, :cache => [:name]
target :user, :cache => [:name]
end
activity :follow_event do
@jmaicher
jmaicher / gist:1018585
Created June 10, 2011 10:17
WARNING: Global access to Rake DSL methods is deprecated
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method [..]::Application#task called at [..]/gems/railties-3.0.5/lib/rails/application.rb:214:in `initialize_tasks'
@jmaicher
jmaicher / gist:1050834
Created June 28, 2011 09:59
Code from hell
<?php
function rechter_rand_unten($rechter_rand)
{
global $rechter_rand;
if ($rechter_rand == 1)
{ ?></td>
<td width="140" class="loop_navi_rechts">
<table width="140" cellspacing="0" cellpadding="0">
<tr>
<td>
@jmaicher
jmaicher / gist:1321972
Created October 28, 2011 09:38
Speed improvements running cucumber against spork (rails 3.1)
# running cucumber without spork
$ time cucumber
Using the default profile...
0 scenarios
0 steps
0m0.000s
cucumber 5.09s user 0.86s system 99% cpu 5.971 total
# running cucumber against spork
input, textarea, select {
font: 13px Courier New,Helvetica,Verdana,Arial,Sans-Serif;
}
/* because courier new in bold is ugly */
#commentform #submit {
font-weight: normal;
}
@jmaicher
jmaicher / example-1.js
Created January 12, 2012 17:17
How Backbone.js Implements Inheritance
// create a constructor which inherits from Backbone.Model
var ToDo = Backbone.Model.extend(
// instance properties
{
toJSON: function() { ... }
},
// static properties
{
createFromJSON: function(jsonObj) { ... }
}
//= require require
require.config({
'baseUrl': '/assets'
});