Skip to content

Instantly share code, notes, and snippets.

View patrick99e99's full-sized avatar

Patrick Collins patrick99e99

  • collinator studios
  • Saratoga Springs, Utah
View GitHub Profile
class Contact < ActiveRecord::Base
has_many :phones
end
@patrick99e99
patrick99e99 / contacts
Created April 28, 2012 18:09
contact migration
class CreateContacts < ActiveRecord::Migration
def self.up
create_table :contacts do |t|
t.string :first_name
t.string :last_name
t.timestamps
end
end
@patrick99e99
patrick99e99 / contact.rb
Created April 28, 2012 18:09
contact and phone models
class Contact < ActiveRecord::Base
end
ree-1.8.7-2011.03 :020 > c
=> #<Comment id: 3, body: "foo!", commentable_id: 111, commentable_type: "Post", user_id: 18, created_at: "2011-07-13 15:25:49", updated_at: "2011-07-27 18:19:04", helpful_at: "2011-07-27 18:19:04", research_report_id: nil>
ree-1.8.7-2011.03 :021 > c.commentable.class
=> Post(id: integer, title: string, method_of_exchange: string, you_tube_url: string, lat: decimal, lng: decimal, bounty: integer, distance: integer, user_id: integer, consider_similar_offers: boolean, description: text, created_at: datetime, updated_at: datetime, address: string, city: string, state: string, zip: string, country: string, county: string, category_id: integer, slug: string, status: string, popularity: integer, delta: boolean, share_count: integer, needs_comment: decimal, needs_offer: decimal, district: string, concierge_flag: string, request_details: text)
ree-1.8.7-2011.03 :023 > c.commentable.blah
NoMethodError: undefined method `blah' for "#<Post:0x1058e57f0>":Post
from /Users/patrick/.rvm/gem
Feature: Updating an existing request
In order to change my mind about what I need
I want to be able to edit my Request
Background:
Given I am logged in with facebook
And I go to the new request page
And I fill in the following:
| I want | Dragon's Lair Arcade Game |
| for | 2000 |
Feature: In order to see the newest or closest posts
I want to be able to change the presentational order of the posts
Background:
Given I am on the posts page
And the following posts exist:
| title | days old | distance |
| bike | 25 | 5 |
| sandwich | 6 | 10 |
| computer | .5 | 25 |
Feature: In order to find posts that are relevant to what I am looking for
I want to be able to search for posts and filter the results
Background:
Given I am on the posts page
And the following posts exist:
| title | days old | price | distance | category |
| bike | .5 | 100 | 5 | Cars & Vehicles |
| sandwich | 6 | 5 | 10 | Stuff |
| computer | 25 | 1000 | 25 | Phones & Electronics |
@patrick99e99
patrick99e99 / campaigns.feature
Created September 21, 2011 19:35
campaigns test
Feature: Marketing Campaigns
Site administrators have created "campaigns" which influence the site's copy and appearance when visiting a special route which maps to a url with a campaign parameter.
Scenario Outline: Visiting pages without a campaign
Given I am on the <page>
Then I should see the <expected text>
And I should see any default images that exist for the "<page>"
Examples:
| page | expected text |
<p>
<%= f.label :roles %><br />
<% for ns in User::NOTIFICATION_SETTINGS %>
<%= check_box_tag "user[notification_settings][]", ns, @user.notification_settings.include?(ns) %>
<%=h notification_setting.humanize %><br />
<% end %>
</p>
mouseMove: function(event) {
var x = event.pageX,
y = event.pageY;
if (self.isOutsideOfIcon(x, y) && self.isOutsideOfMenu(x, y)) {
// mouse has left bounds.. do something here..
}
},
isOutsideOfMenu: function(x, y) {