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
<% # app/views/stores/show.html.erb %> | |
<% cache ["v3", @store] do%> | |
<h1>Store: <%= @store.name %></h1> | |
<%= render @store.employees %> | |
<% end %> | |
<% # app/views/employees/_employee.html.erb %> | |
<% cache ["v3", employee] do %> | |
<div class='employee'> |
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
<!-- app/views/stores/show.html.erb --> | |
<% cache ["v3", @store] do%> | |
<h1>Store: <%= @store.name %></h1> | |
<%= render @store.employees %> | |
<% end %> | |
<!-- app/views/employees/_employee.html.erb --> | |
<% cache ["v3", employee] do %> | |
<div class='employee'> |
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.where(name: "Little Johnny DropTable").first_or_create | |
# => <Student id: 1, first_name: 'Little Johnny DropTable', grade: 2> | |
Student.where(name: "Sally Sue", grade: 5).first_or_create | |
# => <Student id: 2, first_name: 'Sally Sue', grade: 5> | |
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.find_or_create_by_name("Little Johnny DropTable") | |
Student.find_or_create_by_name_and_grade("Sally Sue", 5) |
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
<script src="http://static.tumblr.com/eojssfq/QG5m6cm3z/embedgist.js"></script> |
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
module SlimySlug | |
extend ActiveSupport::Concern | |
included do | |
before_save :set_slug | |
has_many :actions | |
has_many :lobbyists, through: :actions | |
has_many :clients, through: :actions | |
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
module SlimySlug | |
extend ActiveSupport::Concern | |
included do | |
before_save :set_slug | |
end | |
def set_slug | |
self.slug = self.name.downcase.gsub('.','').gsub(' ','-') | |
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 noko_obj.to_html['tbody'] | |
#=> nil |
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 return_nokogiri_table_rows(noko_obj) | |
noko_obj.xpath('/html/body/table/tr/td/table[3]/tr[4]/td[2]/table/tr/td') | |
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
def return_nokogiri_table_rows(noko_obj) | |
noko_obj.xpath('/html/body/table/tbody/tr/td/table[3]/tbody/tr[4]/td[2]/table/tbody/tr/td') | |
end | |