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
| ## the css | |
| .side_by_side { | |
| } | |
| .sbs_rightmost { | |
| float: right; | |
| } | |
| .sbs_left { |
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
| css: | |
| #whos-on-call { | |
| border: 1px solid silver; | |
| margin: 10px 0px 0px 0px; | |
| width: 200px; | |
| background-color: #99ccff; | |
| font: 10px; | |
| } |
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
| CONTROLLER: | |
| def edit_multiple | |
| @on_calls = OnCall.find(params[:on_call_ids]) | |
| end | |
| def update_multiple | |
| @on_calls = OnCall.find(params[:on_call_ids]) | |
| @on_calls.each do |on_call| | |
| on_call.update_attributes!(params[:on_call].reject {|k,v| v.blank?}) |
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
| named_scope :by_month_late, | |
| lambda { | |
| |d| { | |
| :conditions => { | |
| :calendar_date => d.beginning_of_month..d.end_of_month, | |
| "development_completed_on > development_original_completed_on" | |
| }}} | |
| gives: |
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
| named_scope :by_month_late, | |
| lambda { | |
| |d| { | |
| :conditions => { | |
| ["development_completed_on > development_original_completed_on"], | |
| :calendar_date => d.beginning_of_month..d.end_of_month | |
| }}} | |
| now gives: |
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
| named_scope :by_month_late, | |
| lambda { | |
| |d| { | |
| :conditions => [ | |
| "development_completed_on > development_original_completed_on", | |
| :calendar_date => d.beginning_of_month..d.end_of_month] | |
| }} | |
| gives: |
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
| In a model: | |
| def self.on_time | |
| select {|s| ((s.generally_available_on.blank?) && (Date.today <= s.qa_original_completed_on) || (s.generally_available_on <= s.qa_original_completed_on)} | |
| end | |
| returns an error: | |
| ArgumentError: wrong number of arguments (0 for 1) | |
| from /.../app/models/software_release.rb:102:in `select' |
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
| Sadness in the console: | |
| date = Date.parse("2011-03-01") | |
| => Tue, 01 Mar 2011 | |
| >> sw = SoftwareRelease.by_month(date) | |
| => [#<SoftwareRelease id: ...>] | |
| >> sw = SoftwareRelease.by_month(date).select {|s| s.generally_available_on.blank?} | |
| => [#<SoftwareRelease id: ...>] | |
| >> sw = SoftwareRelease.by_month(date).select {|s| s.generally_available_on.blank? && Date.today <= s.qa_original_completed_on } | |
| => [#<SoftwareRelease id: ...>] |
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.on_time | |
| select {|s| s.generally_available_on.blank? ? (Date.today <= s.qa_original_completed_on) : (s.generally_available_on <= s.qa_original_completed_on)} | |
| end | |
| returns error: | |
| sw = SoftwareRelease.by_month(date).on_time | |
| ArgumentError: wrong number of arguments (0 for 1) | |
| but used in the console, it works: |
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
| Models: | |
| class VpnConfig < ActiveRecord::Base | |
| ... | |
| has_many :vpn_accessible_local_nets, :dependent => :destroy | |
| class VpnAccessibleLocalNet < ActiveRecord::Base | |
| ... | |
| belongs_to :vpn_config |