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
| 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
| <!-- 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
| <% # app/views/stores/show.html.erb %> | |
| <% cache @store do%> | |
| <h1>Store: <%= @store.name %></h1> | |
| <%= render @store.employees %> | |
| <% end %> | |
| <% # app/views/employees/_employee.html.erb %> | |
| <% cache 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
| class Store < ActiveRecord::Base | |
| has_many :employees | |
| end | |
| class Employee < ActiveRecord::Base | |
| belongs_to :store, touch: 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
| <% @agency.actions.sort_by { |action| -action.payment }.each do |action| %> | |
| <% cache [action, action.lobbyist_actions, action.lobbyists, action.agency_actions, action.agencies] do %> | |
| <tr> | |
| <td><%= action.purpose %></td> | |
| <td valign="top"> <% action.lobbyists.each do |lobbyist| %> | |
| <%= link_to lobbyist.name, lobbyist_path(lobbyist.slug) %> <br> | |
| <%end%> | |
| </td> | |
| <td valign="top"> <%= link_to action.client.name, client_path(action.client.slug) %> </td> | |
| <td valign="top">$<%= action.payment %></td> |
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
| #source https://github.com/rails/rails/issues/10894 | |
| module ActiveSupport | |
| module Cache | |
| class FileStore < Store | |
| private | |
| # Patch this so we don't have long paths | |
| def key_file_path(key) | |
| fname = URI.encode_www_form_component(key) | |
| hash = Zlib.adler32(fname) |
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 Application < ActiveRecord::Base | |
| def self.model_call_setters | |
| Agency.call_solo_payments | |
| Agency.call_group_payments | |
| Agency.set_sum_payments | |
| Lobbyist.call_team_payments | |
| Lobbyist.call_my_payments | |
| Lobbyist.set_sum_payments |
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
| task :environment => :disable_initializer | |
| task :disable_initializer do | |
| ENV['DISABLE_INITIALIZER_FROM_RAKE'] = 'true' | |
| end |