This file contains 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
GIT | |
remote: git://github.com/seyhunak/twitter-bootstrap-rails.git | |
revision: 9649b2c0b12a374dfece50a3ae31cc56ad778300 | |
specs: | |
twitter-bootstrap-rails (2.2.0) | |
actionpack (>= 3.1) | |
execjs | |
railties (>= 3.1) | |
GEM |
This file contains 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
source 'https://rubygems.org' | |
gem 'rails', '3.2.11' | |
gem 'mysql2' | |
gem 'thin' | |
gem 'jquery-rails' | |
gem 'coffee-rails', '~> 3.2.1' | |
gem 'therubyracer' | |
gem 'less-rails' #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS | |
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' |
This file contains 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
Vertex = Struct.new(:name, :edges) | |
Edge = Struct.new(:v0, :v1, :weight) | |
a = Vertex.new("A") | |
b = Vertex.new("B") | |
c = Vertex.new("C") | |
d = Vertex.new("D") | |
e = Vertex.new("E") | |
f = Vertex.new("F") | |
g = Vertex.new("G") |
This file contains 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
if x > 0 | |
0.upto(y) do |z| | |
a.push(z) | |
end | |
else | |
0.upto(y-1) do |z| | |
a.push(z) | |
end | |
end |
This file contains 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 CategoryConstraint | |
def matches?(request) | |
@categories = [] | |
ProductCategory.all.each do |c| | |
@categories.push(c.slug) | |
end | |
@categories.include?(request.params[:id]) |
This file contains 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
resources :products, :path => 'produkter', :as => 'products', :only => [:index, :show] | |
get ':id', :to => 'product_categories#show', :constraints => CategoryConstraint.new, :as => 'product_category' |
This file contains 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
@bookings.as_json [{:id=>5, :title=>"", :description=>"", :start=>"Wed, 09 May 2012 00:00:00 +0200", :end=>"Wed, 09 May 2012 00:00:00 +0200", :allDay=>true, :recurring=>false, :url=>""}, {:id=>3, :title=>"", :description=>"", :start=>"Mon, 14 May 2012 00:00:00 +0200", :end=>"Sun, 20 May 2012 00:00:00 +0200", :allDay=>true, :recurring=>false, :url=>""}, {:id=>1, :title=>"", :description=>"", :start=>"Tue, 01 May 2012 00:00:00 +0200", :end=>"Sat, 05 May 2012 00:00:00 +0200", :allDay=>true, :recurring=>false, :url=>""}] |
This file contains 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
Object | |
_end: null | |
_id: "5" | |
_start: Wed May 09 2012 00:00:00 GMT+0200 (CEST) | |
allDay: true | |
className: Array[0] | |
description: "" | |
end: null | |
id: 5 | |
recurring: false |
This file contains 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
Booking Load (0.9ms) SELECT "bookings".* FROM "bookings" WHERE "bookings"."product_id" = 1 AND (booked_from > '2012-04-30 00:00:00') AND (booked_to < '2012-06-11 00:00:00') | |
@bookings.scoped: [#<Booking id: 5, product_id: 1, customer_id: 6, booked_from: "2012-05-08 22:00:00", booked_to: "2012-05-08 22:00:00", paid: nil, payment_type: nil, created_at: "2012-04-27 13:32:20", updated_at: "2012-04-27 13:32:20">, #<Booking id: 3, product_id: 1, customer_id: 4, booked_from: "2012-05-13 22:00:00", booked_to: "2012-05-19 22:00:00", paid: nil, payment_type: nil, created_at: "2012-04-26 17:27:21", updated_at: "2012-04-26 17:27:21">, #<Booking id: 1, product_id: 1, customer_id: 2, booked_from: "2012-04-30 22:00:00", booked_to: "2012-05-04 22:00:00", paid: nil, payment_type: nil, created_at: "2012-04-26 14:03:33", updated_at: "2012-04-26 14:03:33">] | |
Completed 200 OK in 28ms (Views: 2.3ms | ActiveRecord: 3.0ms |
This file contains 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 Booking < ActiveRecord::Base | |
validate :booking_period_not_overlapped | |
validates :customer_id, :presence => true, :uniqueness => true | |
validates :product_id, :presence => true | |
validates_datetime :booked_to, :on_or_after => :booked_from | |
validates_datetime :booked_from, :on => :create, :on_or_after => :today | |
belongs_to :product |
NewerOlder