This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # current_account.time_blocks.recently_updated | |
| # result -> lots of records | |
| # current_account.appointments.recently_updated | |
| # result -> NoMethodError Exception: undefined method `recently_updated' for #<Class:0x007fe6a7a13ef8> | |
| class Appointment < ActiveRecord::Base | |
| belongs_to :time_block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Animals.each do |letter, results| | |
| 10.times do | |
| doc = Nokogiri::HTML(open("http://www.ocar.org/page.php?tut=realtor-affiliate-search-results&tid=802&pid=8&first_or_last_name=#{letter}&city=&office=&btc=&op=find_a_realtor&ftut=find-a-realtor&start=#{results_per_page}")) | |
| realtors = {} | |
| ('a'..'z').each do |n| | |
| realtors[n] = Realtor.create | |
| end | |
| doc.css('div.search_results_item').each do |number| | |
| phone_number = /\(\d{3}\)\s\d{3}-\d{4}/.match("#{number.content}") | |
| ('a'..'z').each do |n| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% for micropost in @microposts %> | |
| <tr> | |
| <td class="tdeux"><div class="head1"><%= image_tag("#{ micropost.to_guys ? "guys" : "girl" }-head.png") %></div></td> | |
| <td valign="top"><p class="peopleposts"><%= link_to micropost.content, page_path(micropost) %></p></td> | |
| <td class="td2"><div class="share1"><%= tweet_button(:via => "hmdy", :url => "http://localhost:3000/pages/#{micropost.id}", :text => "#{@micropost.content}", :lang => "en", :related => "helpmedateyou", :count => "none") %></div></td> | |
| </tr> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| time = Date.new(pyear, pmonth).to_time | |
| monthname = Date::MONTHNAMES[time.month] | |
| month = "%02d" % params[:month] | |
| @gift_users = Cisco::TerminationCallDetail.initialize("1").find(:all, :conditions => ['DateTime >= ? AND DateTime <= ?', Date.new(pyear, pmonth).at_beginning_of_month, Date.new(pyear, pmonth).at_end_of_month]) | |
| Date.new(pyear, pmonth).at_beginning_of_month.upto(Date.new(pyear, pmonth).at_end_of_month) do |date| | |
| #totalcounts << @gift_users.select{|u| u.datetime.to_s =~ /#{date.to_s}/ }.size | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MailerObserver < ActiveRecord::Observer | |
| observer :device, :device_problem, :device_location | |
| def after_create(device_problem) | |
| DeviceMailer.problem_device(device_problem.device).deliver | |
| end | |
| def after_save(device_location) | |
| # count active device_locations for location and check against par_levels | |
| # send alert email if necessary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl —header "X-Spree-Token: e115604bcaf72453e17ac548479e426a88c86adff56e87b1" http://127.0.0.1:3000/api/products.json | |
| Started GET "/api/products.json" for 127.0.0.1 at 2012-03-27 14:54:58 +0100 | |
| Processing by Spree::Api::V1::ProductsController#index as JSON | |
| Completed 500 Internal Server Error in 2ms | |
| NoMethodError (undefined method `has_role?' for nil:NilClass): | |
| /Users/briandquinn/Development/spree/api/app/controllers/spree/api/v1/products_controller.rb:45:in `scope' | |
| /Users/briandquinn/Development/spree/api/app/controllers/spree/api/v1/products_controller.rb:6:in `index' | |
| actionpack (3.2.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.8.7 :001 > autoload :MyLibrary, 'my_library' | |
| => nil | |
| 1.8.7 :002 > module FooModule | |
| 1.8.7 :003?> def foo | |
| 1.8.7 :004?> puts 'new foo' | |
| 1.8.7 :005?> end | |
| 1.8.7 :006?> end | |
| => nil | |
| 1.8.7 :007 > class MyLibrary | |
| 1.8.7 :008?> include FooModule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Mytasklistapp::Application.routes.draw do | |
| resources :tasks do | |
| member do | |
| get :done | |
| end | |
| collection do | |
| put :complete | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= form_for edit_multiple_game_flags_path(params[:game_id],@flags) do %> | |
| <table class="accordion"> | |
| <thead> | |
| <tr> | |
| <th>Select</th> | |
| <th>Player</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <% @flags.each do |f| %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DiscussionRepliesController < ApplicationController | |
| before_filter :find_discussion | |
| before_filter :find_discussionreply | |
| def create | |
| @discussionreply = @discussion.discussion_reply.new(params[:discussion_reply]) | |
| if @discussion_reply.save | |
| flash[:notice] = "You replied to a discussion" | |
| redirect_to [@discussion, @discussion_reply] | |
| #redirect_to @discussion |