Skip to content

Instantly share code, notes, and snippets.

@xhoy
Created August 4, 2016 18:18
Show Gist options
  • Save xhoy/d62dfbe3222527228544080457e7c401 to your computer and use it in GitHub Desktop.
Save xhoy/d62dfbe3222527228544080457e7c401 to your computer and use it in GitHub Desktop.
wtf? self != self
>> self
=> #<Activity id: 7126, user_id: 58, start_at: "2016-08-02 03:15:00", end_at: "2016-08-02 10:30:00", worked_hours: #<BigDecimal:7fda363efae0,'0.675E1',18(27)>, vacation_hours: #<BigDecimal:7fda363ef950,'0.51975E0',9(18)>, date: "2016-08-02", information: "othertest">
>> Activity.find(7126)
=> #<Activity id: 7126, user_id: 58, start_at: "2016-07-28 02:45:00", end_at: "2016-07-28 10:15:00", worked_hours: #<BigDecimal:7fda369f7bb8,'0.7E1',9(18)>, vacation_hours: #<BigDecimal:7fda369f7a50,'0.539E0',9(18)>, date: "2016-07-28", information: "test2">
Only clues:
@changed_attributes => {"id"=>7135}
@original_raw_attributes => {"id"=>7126}
#WTF?
User.current_user.activities.order(date: :desc).group_by{|a| [a.date.beginning_of_month, a.status]}
class Activity < ActiveRecord::Base
def status
byebug
#see console.rb
#random code
#self.something = xyz #not working :)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment