Add one of the following formats to the end of the url
.json .xml
| # Find all the proper employees | |
| employees = Employee.find(:all, :conditions => 'conditions to get the right employees') | |
| # Add the employee that we want (by email address) | |
| # to the top of the list | |
| # Then call uniq on it to remove the duplicate | |
| employees.unshift(employees.find{ |employee| employee.email_address == "email we want at the top" }).uniq |
| class Player < ActiveRecord::Base | |
| has_many :game_participations | |
| has_many :games, :through => :game_participations | |
| end | |
| class Game < ActiveRecord::Base | |
| has_many :game_participations | |
| has_many :players, :through => :game_participations | |
| end |
| // Assuming jQuery is on the page, this will append the search tweets | |
| // to an element with the id of 'twitter' | |
| $.getJSON("http://search.twitter.com/search.json?q=adobe+sucks&callback=?", function(data){ | |
| $.each(data.results, function(i, tweet){ | |
| var tweetContent = '<div class="tweet">'; | |
| tweetContent += '<p class="tweet-body">' + tweet.text + '</p>'; | |
| tweetContent += '<p class="tweet-meta"><a href="http://twitter.com/' + tweet.from_user + '">' + tweet.from_user + '</a> at ' + tweet.created_at + '</p></div>'; | |
| $('#twitter').append(tweetContent); | |
| }); | |
| }) |
| class FormBuilder | |
| attr_reader :calls | |
| def initialize(&block) | |
| @calls = [] | |
| @current = @calls | |
| block.call(self) | |
| end | |
| module HasMoney | |
| def self.included(base) | |
| base.extend ClassMethods | |
| end | |
| module ClassMethods | |
| # | |
| # has_money :default_price |
Add one of the following formats to the end of the url
.json .xml
| <% self.class.send :include, Arbre::HTML %> | |
| <%= panel("Hello"){ h2 @test_assign } %> | |
| <%= panel("Hello World"){ } %> |
| ActiveAdmin.register Product do | |
| # Will show the default main content... | |
| show do | |
| # Do stuff before | |
| default_main_content | |
| # Do stuff after | |
| end | |
| # ... Or if you want to customize further |
| #!/user/env ruby | |
| # | |
| # Batch gitmine review a bunch of tickets. | |
| # | |
| # Usage: ruby batch_review.rb 7585 7603 7623 7640 7663 7665 | |
| # | |
| ARGV.each do |issue_id| | |
| system("gitmine checkout #{issue_id} && git pull && git diff master...HEAD") | |
| puts "Merge into master?" |
| #!/bin/bash | |
| set -e | |
| # Run the script: | |
| # ./active-admin-run-tests-on-fork GITHUBUSERNAME BRANCHNAME | |
| # Change this to wherever you want tests to run | |
| tests_dir=~/code/personal/active_admin_forks |