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
<snippet> | |
<content><![CDATA[ | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>${1:tYour title}</title> | |
<link rel="stylesheet" type="${2:reset or normalize css}"> | |
<link rel="stylesheet" type="text/css" href="${3:Your stylesheet}"> |
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
Show hidden characters
{ | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"spell_check": true, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true | |
} |
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
navbar>div>h3+span.top-bar>ul.links>li*6 |
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
<navbar> | |
<div> | |
<h3></h3> | |
<span class="top-bar"> | |
<ul class="links"> | |
<li></li> | |
<li></li> | |
<li></li> | |
<li></li> | |
<li></li> |
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
<snippet> | |
<content><![CDATA[ | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>${1:tYour title}</title> | |
<link rel="stylesheet" type="text/css" href="${2:reset or normalize css}"> | |
<link rel="stylesheet" type="text/css" href="${3:Your stylesheet}"> |
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> | |
<meta charset="UTF-8"> | |
<title>tYour title</title> | |
<link rel="stylesheet" type="text/css" href="reset or normalize css"> | |
<link rel="stylesheet" type="text/css" href="Your stylesheet"> | |
<meta name="keywords" content="meta keywords"> | |
<meta name="description" content="meta description"> |
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 'csv' | |
class Student < ApplicationRecord | |
belongs_to :school | |
[...] | |
def self.all_with_school_details | |
Student.select("students.*, schools.name as school_name, schools.address as school_address").joins(:school) |
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
Student.all_with_school_details.first | |
=> #<Student:0x007f9c26baa580 | |
id: 1, | |
first_name: "Bart", | |
last_name: "Simpson", | |
DOB: Sun, 17 Dec 1989, | |
email: "bart@the-simpsons.com", | |
created_at: Sun, 04 Dec 2016 06:26:52 UTC +00:00, | |
updated_at: Sun, 04 Dec 2016 06:26:52 UTC +00:00, |
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
Student.all_with_school_details.first.school_name | |
=> "Springfield Elementary School" |
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
[...] | |
def self.as_csv | |
CSV.generate do |csv| | |
columns = %w(id first_name last_name DOB school_name school_address) | |
csv << columns.map(&:humanize) | |
all_with_school_details.each do |student| | |
csv << student.attributes.values_at(*columns) | |
end | |
end |
OlderNewer