Skip to content

Instantly share code, notes, and snippets.

@ricoSaw
ricoSaw / gist:5060229
Last active December 14, 2015 08:49
# Möglichkeit 2 Wohl die bessere Lösung mit inverse_of und validates_associated.
class Plan < ActiveRecord::Base
...
has_many :plan_additions, :inverse_of => :plan
validates_associated :plan_additions
accepts_nested_attributes_for :plan_additions
...
@ryanb
ryanb / index.js.erb
Created December 16, 2011 23:22
Infinite scrolling solution covered in revised episode #114: http://railscasts.com/episodes/114-endless-page-revised
$('#products').append('<%= j render(@products) %>');
<% if @products.next_page %>
$('.pagination').replaceWith('<%= j will_paginate(@products) %>');
<% else %>
$('.pagination').remove();
<% end %>
@robbl
robbl / rails31init.md
Created August 24, 2011 12:46 — forked from kjf/rails31init.md
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Rails 3.1 configuration

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@callumacrae
callumacrae / bot.js
Created May 28, 2011 12:19
Node.js IRC bot
var net = require('net'),
irc = {}, config;
config = {
user: {
nick: '',
user: '',
real: '',
pass: ''
},