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 Team < ActiveRecord::Base | |
attr_accessible :name | |
has_many :presenters | |
def compound_team_name | |
name + '_' + department.id | |
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 Team < ActiveRecord::Base | |
attr_accessible :name | |
has_many :presenters | |
end | |
class Presenter < ActiveRecord::Base | |
attr_accessible :name | |
has_many :reports | |
belongs_to :team |
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 Presenter < ActiveRecord::Base | |
attr_accessible :name | |
has_many :reports | |
belongs_to :team | |
def team_name | |
team.compound_team_name | |
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 Presenter < ActiveRecord::Base | |
attr_accessible :name | |
has_many :reports | |
belongs_to :team | |
def team_name | |
team.compound_team_name | |
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 Report < ActiveRecord::Base | |
attr_accessible :title | |
belongs_to :presenter | |
delegate :team_name, to: :presenter, prefix: true | |
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
puts "Hello World!" |
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
p "Enter your favorite number: " | |
number = gets.chomp | |
p "The number you entered was #{number}" |
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
p "Enter a number: " | |
first = gets.chomp.to_i | |
p "Enter a second number: " | |
second = gets.chomp.to_i | |
def multiply(num1, num2) | |
num1 * num2 | |
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
require 'open-uri' | |
print "Enter a website domain you like (without the http://): " | |
website = gets.chomp | |
if website.count(".") >= 2 | |
first_letter = website.index(".") + 1 # we want the letter just after the first dot | |
after_first_letter = first_letter + 1 | |
last_letter = (website.index(".", after_first_letter) - 1) | |
website_title = website[first_letter..last_letter] | |
elsif website.count(".") == 1 |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Hello!</title> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
<div> | |
<h3 data-stuff="to dos">Things I would like to do today:</h3> | |
<input type="text" id="new-to-do-item" placeholder="Enter a new todo item..."> |
OlderNewer