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
| %h1 Wildfire Events | |
| %table.table.table-striped.table-hover | |
| %thead | |
| %tr | |
| %th Location | |
| %th | |
| %th Fire Duration | |
| %th | |
| %th |
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 'time' | |
| class MyMail | |
| def initialize(email_path) | |
| @email = load_email(email_path) | |
| end | |
| # Return the entire email | |
| def email |
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
| = number_field_tag "rating", nil, in: 0...6, class: "rating", id: "rating", step: 1, "data-size" => "md", value: "#{if @user.has_evaluation?(:seller_reputation, current_user) then @user.evaluated_value(current_user) else 0 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
| User visits site | |
| User logins in or registers | |
| Login -> input email, password -> redirect to home | |
| Register -> provide user details, upload avatar photo -> submit -> redirect to login | |
| User to home page | |
| User edits settings | |
| Clicks settings -> edit profile -> provides updated information -> submit -> back to home | |
| -> clicks delete profile -> inputs password -> submit -> redirect to login |
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 Photo < ActiveRecord::Base | |
| 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
| Let's say you have a database containing two tables, doctors and patients. | |
| This means you have two models, Doctor and Patient. | |
| We want to find all doctors who have female patients. | |
| Our relationship (one to many) is based on the doctor_id being a foreign key in the patients table. | |
| To query through Rails we use: | |
| Doctor.joins(:patients).where('patients.gender = ?', 'female') |
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 Doctor < ActiveRecord::Base | |
| has_many :patients | |
| end | |
| class Patient < ActiveRecord::Base | |
| belongs_to :doctor | |
| 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 'rspec' | |
| class Match | |
| attr_reader :players, :winner | |
| def initialize | |
| @players = [TennisPlayer.new] * 2 | |
| end | |
| def winner |
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 World | |
| attr_reader :cells, :cells_with_neighbors, :cells_that_should_live, :cells_that_should_die | |
| # [ | |
| # [cell cell cell], | |
| # [cell cell cell], | |
| # [cell cell cell] | |
| # ] | |
| def initialize |
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
| #Build track | |
| # Begin the game | |
| # Assign user a horse | |
| # Create competition | |
| #Horse | |
| # Display movement | |
| # Be responsible for movement | |
| # Updates horse's position |