This file contains 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
<%= form_tag(search_path, :method => "get") do %> | |
<%= label_tag(:q, "Search for:") %> | |
<%= text_field_tag(:q) %> | |
<%= submit_tag("Search") %> | |
<% end %> | |
# from http://guides.rubyonrails.org/form_helpers.html |
This file contains 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 'uuidtools' | |
This file contains 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
add_index :table, :column, :unique => true | |
remove_index :table, :column |
This file contains 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 CustomJob | |
def before(job) | |
Delayed::Context.set(:handler, job.handler) | |
Delayed::Context.set(:attempt, job.attempts + 1) | |
Delayed::Context.set(:last_error, job.last_error) if job.last_error | |
end | |
def after(job) | |
Delayed::Context.clear |
This file contains 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
Day Job: Sr. Software Engineer at ThinkNear | |
Open Source contribution (if any): rails docs and guides | |
Tell me about your experience with Ruby/Rails: started using it in fall 2010, and have been on it full time every since. Big change from my background in Java (used to work at Amazon.com) | |
How do you use GitHub: for everything. personal and business. We keep our companies repositories on github. We also use it to collaborate with contractors. | |
Favorite luchador(es):Rikochet |
This file contains 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 JobClass | |
def perform | |
begin | |
#I do stuff here | |
rescue Exception => e | |
# catch all exceptions | |
HoptoadNotifier.notify(e) | |
ensure | |
# we want this job to just run continuously, but we don't have an 'auto' way to do that | |
# so we schedule a new one every time we run |
This file contains 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 serializable_hash(options = {}) | |
# TODO exclude the id | |
options = {:include => [:address, :location, :hours_of_operations, :slow_periods, :discounts], | |
:except => [:created_at, :updated_at, :creating_user_id]}.merge(options ||= {}) | |
super options | |
end |
This file contains 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 serializable_hash(options = {}) | |
my_options = {:except => [:id, :category, :draws, :owner_identifier, :owner_reference_data, | |
:primary_image, :related_data, :created_at, :updated_at, :creating_user_id ], | |
:include => []}.merge(options ||= {}) | |
s = serializable_hash(my_options) | |
s["address"] = address.serializable_hash_for_public(options) | |
s | |
end |
This file contains 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
<% f.fields_for :member_collection do |builder| %> | |
<%= render "membrer_collection_fields", :form => builder %> | |
<% end %> |
This file contains 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
<% @merchant_campaign.instance_variable_get(:@attributes).each do |attribute, value| %> | |
<tr> | |
<td><%= attribute %></td> | |
<td><%= value %></td> | |
</tr> | |
<% end %> |