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
a = true and false | |
puts a | |
a = true && false | |
puts a |
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
module A | |
def test | |
puts "module A" | |
end | |
end | |
module B | |
def test | |
puts "module B" | |
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
module A | |
def self.test | |
"FOO" | |
end | |
end | |
module Yo | |
module A | |
def self.test | |
"BAR" |
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 CallCenter < ActiveRecord::Base | |
def self.prepare_to_work | |
all.each do |call_center| | |
if call_center.name == 'test1' | |
call_center.check_callmanagers | |
call_center.update_attributes(handled: 0) | |
elsif call_center.name == 'test2' | |
call_center.send_letters_to_customers | |
call_center.remove_managers |
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 Finance < ActiveRecord::Base | |
validate :check_amount | |
def check_amount | |
errors.add(:check_amount, 'quantity limit over!') if amount > 100 | |
end | |
end | |
first = Finance.first | |
second = Finance.last |
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 Client | |
attr_reader :item | |
def initialize(item) | |
@item = item | |
end | |
def calculate_something | |
80 * 20 | |
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
module AddMePlease | |
def some_useful_method | |
2 + 2 | |
end | |
def second_useful_method | |
2 * 3 | |
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
CREATE TABLE customers ( | |
source_id integer, | |
name varchar(255) | |
); | |
INSERT INTO customers (source_id, name) values (null, 't1'), (1, 't2'), (2, 't3'), (3, 't5'), (null, 't5'); | |
SELECT COUNT(*) FROM customers WHERE source_id <> 3; |
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
CREATE TABLE orders ( | |
id integer, | |
name varchar(255), | |
address varchar(255) | |
); | |
CREATE TABLE order_items ( | |
id integer, | |
price integer, | |
order_id integer, |
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 A | |
private | |
def some_method | |
puts 'HOLA!' | |
end | |
end | |
class B < A | |
def test_some_method_exec |
OlderNewer