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
<%= select_tag 'team_id', options_from_collection_for_select(@teams, "id", "name") %> | |
<script> | |
$(function(){ | |
$('#team_id').bind('change', function () { | |
var url = "/Teamleader/" + $(this).val() | |
if (url) { | |
window.location.replace(url); | |
} | |
return false; |
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
[1] Time.now + 10.days | |
[2] 10.days.from_now | |
[3] -10.days.ago | |
[4] DateTime.now.days_ago(-10) | |
[5] Date.today + 10 |
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
#hellow | |
hellow | |
#hellow | |
width: 10px | |
white-space: nowrap | |
overflow: hidden | |
text-overflow: ellipsis |
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 Country < ActiveRecord::Base | |
has_many :registrations | |
has_many :members | |
has_many :distribution_groups, :through => :members | |
end | |
class DistributionGroup < ActiveRecord::Base | |
has_many :members | |
has_many :countries, :through => :members | |
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
class Capybara::Session | |
def submit(element) | |
Capybara::RackTest::Form.new(driver, element.native).submit({}) | |
end | |
end | |
#in the test | |
fill_in 'Search', with: 'dice' | |
form = find '#search-form' # find the form |
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
@companies = Company.includes(:company_users).search(params[:q]).page(params[:page]).per(params[:per_page]||6) |
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 outstanding_totals | |
Invoice.with_state(:sent).to_a.sum(&:total_cents) | |
end | |
def drafted_totals | |
Invoice.with_state(:drafted).to_a.sum(&:total_cents) | |
end | |
def paid_totals | |
Invoice.with_state(:paid).to_a.sum(&:total_cents) |
NewerOlder