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 Movie < ActiveRecord::Base | |
validate :does_not_overlap, :valid_times | |
validate :check_start_time_overlap, :check_end_time_overlap | |
private | |
def valid_times | |
if start_time >= end_time | |
errors.add(:end_time, "Movie with id #{id} end_time must be posterior to start_time") |
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 Movie < ActiveRecord::Base | |
belongs_to :channel | |
validate :does_not_overlap, :valid_times | |
def self.from_xml(xml) | |
id = xml.attr('id') #parse movie id | |
channel = Channel.find_by_codename(xml.child.name) #get the channel from db | |
name = xml.child.xpath('name').text #get name | |
start_time = parse_time(xml.child.xpath('start_time').text) | |
end_time = parse_time(xml.child.xpath('end_time').text) |
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
edit_image GET /images/:id/edit(.:format) images#edit | |
image PATCH /images/:id(.:format) images#update | |
PUT /images/:id(.:format) images#update |
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
ready = -> | |
$('.make-switch')['bootstrapSwitch']() | |
$('#featuresCarousel').carousel() | |
$(document).ready ready | |
$(document).on 'page:load', ready |
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
irb(main):001:0> User.create(name: "dudu", email: "[email protected]", password: "1234", password_confirmation: "1234") | |
(1.0ms) begin transaction | |
User Exists (0.0ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('[email protected]') LIMIT 1 | |
Binary data inserted for `string` type on column `password_digest` | |
SQL (4.0ms) INSERT INTO "users" ("created_at", "email", "name", "password_digest", "updated_at") VALUES (?, ?, ?, ? | |
[["created_at", Mon, 18 Nov 2013 20:50:04 UTC +00:00], ["email", "[email protected]"], ["name", "dudu"], ["password_digest | |
2a$10$ENowSeWI6nGZbVIHVUBfuuwKEWeZ9I81Ci/Nru2Q6Q0.paUi7kFXu"], ["updated_at", Mon, 18 Nov 2013 20:50:04 UTC +00:00]] | |
(74.1ms) commit transaction | |
=> #<User id: 5, name: "dudu", email: "[email protected]", created_at: "2013-11-18 20:50:04", updated_at: "2013-11-18 20:50 | |
password_digest: "$2a$10$ENowSeWI6nGZbVIHVUBfuuwKEWeZ9I81Ci/Nru2Q6Q0...."> |
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
@font-face { | |
font-family: 'Molle'; | |
src: font-url('molle-regular-webfont.eot'); | |
src: font-url('molle-regular-webfont.eot?#iefix') format('embedded-opentype'), | |
font-url('molle-regular-webfont.woff') format('woff'), | |
font-url('molle-regular-webfont.ttf') format('truetype'), | |
font-url('molle-regular-webfont.svg#molleregular') format('svg'); | |
font-weight: normal; | |
font-style: normal; | |
} |
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 Feature < ActiveRecord::Base | |
has_one :project_item, as: :item, class_name: "ProjectItem" | |
end | |
class Milestone < ActiveRecord::Base | |
has_one :project_item, as: :item, class_name: "ProjectItem" | |
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
pow(pow(x, n / 2), 2) | |
pow(x, n / 2) * pow(x, n / 2) |
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
NestedRoutesTest::Application.routes.draw do | |
namespace :admin do | |
resource :group do | |
member do | |
get "test/:test", to: "groups#new", as: "test" | |
end | |
end | |
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
Users: | |
- | |
id: 1 | |
name: spamo | |
- | |
id: 2 | |
name: universe | |
Carts: | |
- |