Skip to content

Instantly share code, notes, and snippets.

@jonpaul
jonpaul / _game.html.erb
Created January 10, 2011 15:03
snippet from show action
<img src="<%= stores.name %>/<%= week.title %>/<%= game.image %>" width="329" height="215" alt="Content Inline" hspace="0" vspace="4" class="inline">
<h2><%= game.title %></h2>
<a href="/games/<%= game.url %>">
<img src="http://news.gs1.net/<%= @week.title %>/<%= game.image %>" width="329"
height="215" alt="Content Inline" hspace="0" vspace="4" class="inline"></a>
<p class="first"><%= game.body %></p>
<%= store %>
<br />
<a href="/games/<%= game.url %>">
<img src="http://news.gs1.net/<%= @week.title %>/download.png" width="118"
height="59" alt="Content Inline"></a> <a href="#top" class="center">Back to top^</a>
@jonpaul
jonpaul / pages_controller.rb
Created January 31, 2011 20:36
rubytutorial.org microposts invalid SQL statement
class PagesController < ApplicationController
def home
@title = "Home"
if signed_in?
@micropost = Micropost.new
@feed_items = current_user.feed.paginate(:page => params[:page])
end
end
.
.
@jonpaul
jonpaul / _content_page.html.erb
Created February 28, 2011 19:24
issue rendering partial to side_body for all pages#
<%
# provide a default array for collecting CSS for sections
css = []
# if 'sections' is passed in as a local_assigns, all of this is ignored.
if local_assigns[:sections].blank?
# always have a title
sections = [{:yield => :body_content_title, :fallback => page_title, :title => true}]
# append sections from this page.
@jonpaul
jonpaul / create_revenue_split_rules.rb
Created March 22, 2011 19:45
Trace error from migration
class CreateRevenueSplitRules < ActiveRecord::Migration
def self.up
create_table :revenue_split_rules do |t|
t.integer :percentage_of_new, :null => false, :default => 0
t.integer :percentage_of_mid, :null => false, :default => 0
t.integer :percentage_of_lib, :null => false, :default => 0
t.integer :days_of_new, :null => false, :default => 0
t.integer :days_of_mid, :null => false, :default => 0
t.integer :share_type, :default => 0
t.string :revenue_splitable_type
Processing ApplicationController#index (for 127.0.0.1 at 2011-03-28 16:37:43) [GET]
Rendering /Users/gamestreamer/Desktop/gamestreamer_mainrepo/gamestreamer/vendor/plugins/facebooker/templates/layout.erb (200)
New Relic Agent not running
** [Hoptoad] Notifier 2.2.2 ready to catch errors
SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
Genre Load (0.1ms) SELECT * FROM `genres`
Genre Columns (0.9ms) SHOW FIELDS FROM `genres`
Genre Load (0.1ms) SELECT * FROM `genres`
Genre::Translation Load (0.3ms) SELECT * FROM `genre_translations` WHERE (`genre_translations`.`locale` IN ('en')) AND (`genre_translations`.genre_id = 2)
Genre::Translation Columns (0.9ms) SHOW FIELDS FROM `genre_translations`
@jonpaul
jonpaul / buy.html.erb
Created May 23, 2011 19:37
# price range select
<%= f.select :price_gteq, (100000..900000).step(100000).collect { |num| [ number_to_currency(num, :precision => 0), num ] },
{ :include_blank => 'Price Range' }, { :class => 'short' } %>
<!-- This select actually, now needs to include:
Any
10,000
20,000
30,000
40,000
50,000
def create
@note = @project.notes.new(params[:note])
@note.save
respond_with(@note, :layout => !request.xhr? )
end
@jonpaul
jonpaul / view.html.erb
Created May 31, 2011 15:52
Can't get client-side validation out of this form...
<div id="noresultBox">
<%= semantic_form_for :opportunity, :url => 'http://crm.investyourcar.com/opportunities/create', :html => { :id => "noResults" } do |f| %>
<div class="box">
<ul>
<li>
<%= label_tag 'Full Name' %>
<%= text_field_tag :name %>
</li>
<li id="noresultsSubmit">
<%= submit_tag "Contact InvestYourCar.com" %>
before_filter :set_current_user
def new
set_tab :sell
@listing = VehicleListing.new
@vehicle_makes = VehicleMake.all
@vehicle_models = VehicleModel.where(:vehicle_make_id => 1)
@product = Product.find_by_id(params[:product_id])
if @listing.vehicle_listing_images.empty?
@images = VehicleListingImage.where(:cart_id => @cart.id)