Duckily

Activity Graph

Page 1 of 6 | Next »

2017-04-12

[00:27:25] Duckily: Quit: Textual IRC Client: www.textualapp.com

2017-04-11

[23:55:44] Duckily: has joined #RubyOnRails

2017-04-01

[02:20:53] Duckily: Quit: ZZZzzz…
[02:55:34] Duckily: has joined #RubyOnRails
[03:11:02] Duckily: Quit: ZZZzzz…
[11:20:55] Duckily: has joined #RubyOnRails
[11:28:48] Duckily: Quit: Textual IRC Client: www.textualapp.com

2017-03-31

[02:09:50] Duckily: Quit: ZZZzzz…
[05:50:08] Duckily: has joined #RubyOnRails
[09:28:17] Duckily: Quit: ZZZzzz…
[18:07:18] Duckily: has joined #RubyOnRails
[18:18:58] Duckily: Quit: ZZZzzz…
[18:43:40] Duckily: has joined #RubyOnRails
[18:53:56] Duckily: Quit: ZZZzzz…
[20:01:21] Duckily: has joined #RubyOnRails
[21:56:47] Duckily: Quit: ZZZzzz…
[22:07:49] Duckily: has joined #RubyOnRails
[23:07:36] Duckily: Quit: ZZZzzz…
[23:20:47] Duckily: has joined #RubyOnRails

2017-03-30

[04:06:59] Duckily: Quit: ZZZzzz…
[06:21:28] Duckily: has joined #RubyOnRails
[09:45:12] Duckily: Quit: ZZZzzz…
[17:31:57] Duckily: has joined #RubyOnRails
[19:23:04] Duckily: Quit: ZZZzzz…
[19:23:24] Duckily: has joined #RubyOnRails

2017-03-29

[02:57:40] Duckily: Quit: ZZZzzz…
[04:16:48] Duckily: has joined #RubyOnRails
[12:46:10] Duckily: Quit: ZZZzzz…
[16:48:21] Duckily: has joined #RubyOnRails
[16:50:16] Duckily: Client Quit
[17:16:14] Duckily: has joined #RubyOnRails
[17:22:28] Duckily: Quit: ZZZzzz…
[17:57:18] Duckily: has joined #RubyOnRails
[17:58:40] Duckily: Client Quit
[18:00:57] Duckily: has joined #RubyOnRails

2017-03-28

[19:08:25] Duckily: has joined #RubyOnRails
[19:08:32] Duckily: I read something from DHH about having no more than 13 files in a folder one time and I can't find it, any ideas?
[19:56:05] Duckily: Quit: ZZZzzz…
[20:23:36] Duckily: has joined #RubyOnRails
[20:40:37] Duckily: Quit: ZZZzzz…
[20:51:22] Duckily: has joined #RubyOnRails

2017-03-24

[02:53:23] Duckily: has joined #RubyOnRails
[05:15:59] Duckily: Quit: ZZZzzz…
[05:33:09] Duckily: has joined #RubyOnRails
[07:24:10] Duckily: Quit: ZZZzzz…
[07:32:48] Duckily: has joined #RubyOnRails
[07:33:05] Duckily: Client Quit

2017-03-23

[05:24:54] Duckily: Quit: ZZZzzz…

2017-03-22

[01:58:58] Duckily: Quit: ZZZzzz…
[04:22:09] Duckily: has joined #RubyOnRails
[14:26:49] Duckily: Quit: ZZZzzz…
[20:49:47] Duckily: has joined #RubyOnRails

2017-03-21

[19:32:44] Duckily: Quit: ZZZzzz…
[22:04:57] Duckily: has joined #RubyOnRails

2017-03-20

[00:45:16] Duckily: has joined #RubyOnRails
[17:19:26] Duckily: Quit: ZZZzzz…
[23:29:14] Duckily: has joined #RubyOnRails

2017-03-19

[00:19:41] Duckily: has joined #RubyOnRails
[00:30:30] Duckily: Quit: ZZZzzz…
[03:52:32] Duckily: has joined #RubyOnRails
[14:22:51] Duckily: Quit: ZZZzzz…

2017-03-18

[14:09:40] Duckily: Quit: ZZZzzz…

2017-03-17

[13:30:27] Duckily: Quit: ZZZzzz…
[13:33:04] Duckily: has joined #RubyOnRails
[15:59:05] Duckily: Quit: ZZZzzz…
[16:01:21] Duckily: has joined #RubyOnRails
[16:01:56] Duckily: Client Quit
[16:03:28] Duckily: has joined #RubyOnRails
[16:06:43] Duckily: Client Quit
[23:32:11] Duckily: has joined #RubyOnRails

2017-03-16

[03:07:20] Duckily: Quit: ZZZzzz…
[04:43:04] Duckily: has joined #RubyOnRails
[13:44:57] Duckily: Quit: ZZZzzz…
[21:15:36] Duckily: has joined #RubyOnRails

2017-03-15

[12:31:38] Duckily: Quit: ZZZzzz…
[21:22:54] Duckily: has joined #RubyOnRails

2017-03-14

[03:14:43] Duckily: has joined #RubyOnRails
[18:28:58] Duckily: Quit: ZZZzzz…
[18:30:25] Duckily: has joined #RubyOnRails
[20:48:52] Duckily: Quit: ZZZzzz…
[20:52:54] Duckily: has joined #RubyOnRails

2015-08-20

[01:49:40] Duckily: has joined #RubyOnRails
[05:05:26] Duckily: Quit: Duckily
[05:27:44] Duckily: has joined #RubyOnRails
[08:09:25] Duckily: Quit: Duckily
[09:03:05] Duckily: has joined #RubyOnRails
[09:03:16] Duckily: Client Quit

2015-08-19

[06:52:38] Duckily: Quit: Duckily
[06:58:27] Duckily: has joined #RubyOnRails
[07:02:26] Duckily: Client Quit
[17:51:14] Duckily: has joined #RubyOnRails
[19:14:52] Duckily: Quit: Duckily
[21:27:01] Duckily: has joined #RubyOnRails
[23:35:23] Duckily: Ping timeout: 246 seconds
[23:38:14] Duckily: has joined #RubyOnRails
[23:50:56] Duckily: Quit: Duckily

2015-08-18

[10:31:36] Duckily: Quit: Duckily
[19:58:19] Duckily: has joined #RubyOnRails

2015-08-17

[22:00:15] Duckily: has joined #RubyOnRails
[22:01:26] Duckily: i have an integer attribute on an organization named ???plan_limit???, which i want to be able to set to nil, for an unlimitted plan
[22:02:12] Duckily: whats the best way for setting this to nil?
[22:02:19] Duckily: from a form
[22:05:38] Duckily: https://gist.github.com/anonymous/d0a26e76b5f3d39d0ff0
[22:05:50] Duckily: is this the best way to do it with a virtual attribute?
[22:06:08] Duckily: seems kind of hacky
[22:06:58] Duckily: having a random checkbox that you manage in the controller doesn???t seem too much better??? any other ideas?
[22:08:29] Duckily: smathy: yeah
[22:08:52] Duckily: so via javascript i thought id hide the number field depending on whether its checked
[22:09:35] Duckily: i could also just use pure js and have the checkbox/button not just hide the field but clear it and then the server can set to nil if it doesn???t get an attribute
[22:13:08] Duckily: smathy: wait really?
[22:13:25] Duckily: smathy: i though it just doesn???t update?
[22:14:28] Duckily: smathy: is that because its a number field
[22:14:41] Duckily: smathy: thats why i thought it, i suppose
[22:14:53] Duckily: smathy: ok so ill just handle it in js then, thanks!
[22:15:12] Duckily: smathy: right, i don???t know why i made that assumption

2015-06-02

[01:52:48] Duckily: Quit: Duckily
[03:22:23] Duckily: has joined #RubyOnRails
[10:53:16] Duckily: Quit: Duckily
[11:46:09] Duckily: has joined #RubyOnRails
[12:02:09] Duckily: Quit: Duckily
[13:14:56] Duckily: has joined #RubyOnRails
[14:01:51] Duckily: Read error: Connection reset by peer
[14:02:10] Duckily: has joined #RubyOnRails
[14:18:46] Duckily: Ping timeout: 264 seconds

2015-06-01

[06:53:43] Duckily: has joined #RubyOnRails
[06:54:05] Duckily: how do you use unscoped on the join model of a has_many :through ?
[06:55:42] Duckily: i essentially want to do has_many :books, through: libraries.unscoped
[12:37:52] Duckily: Quit: Duckily
[21:27:33] Duckily: has joined #RubyOnRails

2015-05-30

[00:59:28] Duckily: whats the best way to do a joins requiring a datetime
[00:59:44] Duckily: :created_at => "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}"
[01:00:02] Duckily: i meant ???created_at > #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}"
[01:07:02] Duckily: Radar: its a join
[01:07:31] Duckily: @organizations.joins("LEFT OUTER JOIN orders AS created_orders ON (created_orders.organization_id = organizations.id AND created_orders.created_at > #{params[:from]} AND created_orders.created_at < #{params[:to]})")
[01:07:58] Duckily: the beast, i???m trying to figure out how to avoid injection attack and format date correctly
[01:08:18] Duckily: using a where clause will implicitly convert the query to an inner join
[01:12:29] Duckily: i wish rails supported inserting values into joins, i really don???t get why it doesn???t have the same syntax as the where clause for joins
[01:13:37] Duckily: i thought thats essentially what i???m doing. not sure i follow, can you give an example?
[01:15:37] Duckily: pipework: thats what im giving it in the example above, no?
[01:16:02] Duckily: @organizations.joins("LEFT OUTER JOIN orders AS created_orders ON (created_orders.organization_id = organizations.id AND created_orders.created_at > #{params[:from]} AND created_orders.created_at < #{params[:to]})")
[01:18:11] Duckily: pipework: its a joins query though
[01:18:24] Duckily: rails doesn???t support that syntax for joins queries
[01:18:29] Duckily: i don???t know why :-(
[01:22:08] Duckily: pipework: Organization.joins("LEFT OUTER JOIN orders AS created_orders ON (created_orders.organization_id = organizations.id AND created_orders.created_at > ?)", "2015-05-29 18:21:23")
[01:22:28] Duckily: ActiveRecord::StatementInvalid: SQLite3::SQLException: near "2015": syntax error: SELECT "organizations".* FROM "organizations" LEFT OUTER JOIN orders AS created_orders ON (created_orders.organization_id = organizations.id AND created_orders.created_at > ?) 2015-05-29 18:21:23
[01:22:48] Duckily: seems to concatenate the values together
[01:23:21] Duckily: really bizarre
[01:23:39] Duckily: i figured out what was wrong with the original query, needed quotes around the inserted datetimes
[01:24:15] Duckily: ??????#{params[:from]}')"
[01:24:22] Duckily: ?????? ???#{params[:from]}')"
[01:24:25] Duckily: like that i meant
[01:25:37] Duckily: now i just need to see if rails has a quick way of formatting the datetime so i don???t need strftime and also a way to prevent injections
[01:37:35] Duckily: pipework: so the solution seems to be sanitize_sql_array which also seems to no longer work in rails 4 :-(
[01:37:59] Duckily: https://github.com/Casecommons/pg_search/issues/7
[01:51:09] Duckily: it doesn???t seem deprecated but i can???t figure out how to use it http://api.rubyonrails.org/classes/ActiveRecord/Sanitization/ClassMethods.html#method-i-sanitize_sql_array
[10:40:04] Duckily: Quit: Duckily
[23:52:35] Duckily: has joined #RubyOnRails
[23:57:28] Duckily: Ping timeout: 256 seconds

2015-05-29

[22:22:25] Duckily: has joined #RubyOnRails
[22:23:09] Duckily: whats the best way to dynamically count assocations (no using counter cache)
[22:23:32] Duckily: i need to do it dynamically because i want to only count assocations in a certain time period
[22:25:30] Duckily: smathy: exactly but doing so on an index page of bars without creating an n+1 query for foos
[22:28:28] Duckily: smathy: that will give you one count
[22:28:47] Duckily: Organization.joins(' LEFT OUTER JOIN orders ON orders.organization_id = organizations.id).select(???organizations.*, COUNT(*) AS orders_count').group(???organizations.id')
[22:28:54] Duckily: im thinking it will have to be something like that
[22:31:30] Duckily: smathy: heh thats pretty neat, didn???t know you could do that
[22:31:49] Duckily: smathy: doesn???t exactly solve the issue though, i still need a list of bar objects
[22:32:05] Duckily: with where clauses on them
[22:33:34] Duckily: smathy: how do i get bar objects returned though? this seems to only be returning a hash of values
[22:34:56] Duckily: so i would iterate through both arrays simultaneously to populate a table?
[22:37:36] Duckily: hmm, do you think thats a better approach than doing a join?
[22:38:46] Duckily: Organization.where(???name ILIKE ????, params[:search]).joins(' LEFT OUTER JOIN orders ON orders.organization_id = organizations.id AND orders.created_at < ????, 30.days.ago).select(???organizations.*, COUNT(*) AS orders_count').group('employees.id')
[22:39:15] Duckily: i need conditions on both bars and foos
[22:39:39] Duckily: i like your approach better, but how would i do that?
[22:40:14] Duckily: so i only want to count orders with a specific datetime and i only want organizations that match a search query and other clauses
[22:40:18] Duckily: for instance, limit
[22:41:50] Duckily: smathy: ah i should have mentioned that, the table is a list of organizations so it needs pagination and stuff
[22:42:11] Duckily: smathy: i really like your approach though and will keep it in mind thanks
[22:51:30] Duckily: smathy: this doesn???t seem to be returning the orders_Count though Organization.joins('LEFT OUTER JOIN orders ON orders.organization_id = organizations.id').where('orders.created_at < ?', 30.days.ago).select('organizations.*, COUNT(*) AS orders_count').group('organizations.id')
[22:52:56] Duckily: smathy: i needed to use orders.id instead of * for count
[22:53:04] Duckily: i think this should work
[23:00:20] Duckily: smathy: ok i have a little caveat i need to do the same for another model locations, (get the count) which is joined to organiizations through orders
[23:00:47] Duckily: but i don???t want to constrain orders in that join by the same conditions as the orders count
[23:05:37] Duckily: simpler: https://gist.github.com/anonymous/46320da3ebeab418f55e
[23:05:57] Duckily: will this only return locations for which their order was created in the last 30 days?

2015-04-07

[08:43:38] Duckily: if you have a message object with a sender and recipient id, what is the cleanest way to get all messages (both sent and received) for a user?
[08:53:28] Duckily: arup_r: in what way?

2015-04-06

[04:41:05] Duckily: is there a way to use devise confirmable without ever placing a restriction on users signin in

2015-03-20

[17:45:03] Duckily: How would you generate and sha1 digest from an s3 file while uploading to compare later for duplicate deteection?
[17:45:27] Duckily: I found this, but it won???t work with s3 https://www.ruby-forum.com/topic/4417359
[17:49:48] Duckily: This doesn???t work either: https://railsforum.com/topic/533-carrierwave-and-sha1-duplicate-image-test/
[17:50:25] Duckily: > Digest::SHA1.file(d.media.path).hexdigest
[17:50:26] Duckily: Errno::ENOENT: No such file or directory @ rb_sysopen - uploads/document/media/14/IMG_0681.jpg
[17:50:35] Duckily: also tried using the url

2014-12-09

[02:52:17] Duckily: i think this is a fairly forwards straight question, but my google foo isn???t up to par and it seems like its been an issue in the past
[02:52:27] Duckily: how do you order an included association?
[02:56:30] Duckily: using Order has_many :locations, -> { reorder(:located_at) } Order.limit(5).includes(:locations) -> SELECT "locations".* FROM "locations" WHERE "locations"."order_id" IN (1955, 1956, 1957, 1958, 1959) ORDER BY "locations"."id" DESC, locations.located_at asc
[02:56:53] Duckily: its ordering by locations.id for some reason
[03:00:33] Duckily: Radar: https://gist.github.com/anonymous/cbcf50e4d2ad2bab30a5
[03:01:27] Duckily: hmm i have no idea who added that default_scope, but shouldn???t the reorder fix that anyway?
[03:02:22] Duckily: i have no idea why thats there, ugh i saw it as soon as you mentioned checking. i guess the answer is no
[03:05:21] Duckily: Radar: thanks

2014-11-19

[03:48:45] Duckily: tmoore: but that won???t yield 100
[03:49:51] Duckily: if i use ceil, the average is often far too few records, if i use floor, its far too many
[03:50:05] Duckily: if i display over 100 (on map) the map breaks
[03:50:18] Duckily: smathy: exactly
[03:50:32] Duckily: smathy: here???s my solution rounding up: https://gist.github.com/anonymous/54e1770399667072f6bf
[03:51:49] Duckily: tmoore: right, so my solution would be to take the decimal of the modulus, and alternat at that rate betwee ceil and floor
[03:52:10] Duckily: tmoore: that should in theory work right?
[03:52:25] Duckily: smathy: that wouldn???t be an even distribution though
[03:52:38] Duckily: smathy: there???s a chance i could get the first 100 records
[03:54:20] Duckily: smathy: obvisouly, but there???s a high probability that 1/40 requests you won???t see where the trip ended for instance
[03:54:49] Duckily: smathy: in other words, it would be equally as rare that the points are precisely evenly distributed
[03:54:58] Duckily: more often than not, you will see distribution bias
[03:55:17] Duckily: tmoore: just wondering if there???s a better solution
[03:55:30] Duckily: smathy: well as precisely as possible
[03:55:46] Duckily: you can??? show half a point
[03:57:42] Duckily: smathy: thats simpler than my solution, thanks
[03:58:16] Duckily: the way i solved it was by taking the remainder of the modulus and floor/ceil at the ratio of that remainder
[03:58:48] Duckily: smathy: but that would probably be unecessarily complicated
[03:59:46] Duckily: tmoore: http://stackoverflow.com/questions/11903839/algorithm-to-spread-selection-over-a-fixed-size-array/11934794#11934794
[03:59:52] Duckily: found a much simpler one
[04:06:14] Duckily: tmoore: why does he subtract 1 when calculating the step?
[04:07:00] Duckily: if you want 1 record, it would cause an error?
[04:07:35] Duckily: smathy: why is it subtracting one from the denominator? if you want 1 record, you would get an error
[04:08:13] Duckily: tmoore: couldn???t you just round?
[04:09:01] Duckily: tmoore: ok thatnks!
[04:09:21] Duckily: smathy: couldn???t you just round? if index == stride.round?
[04:11:03] Duckily: to determine if record is added
[04:11:07] Duckily: but i don???t think that would work
[04:11:27] Duckily: rhizome: it will obviously only match once
[04:14:07] Duckily: lampd1: for what?
[04:14:19] Duckily: lampd1: platform, etc
[04:14:42] Duckily: https://gist.github.com/anonymous/35d806c1b8f8b06775c9
[04:15:22] Duckily: smathy: ah ok
[04:17:00] Duckily: rhizome: you wouldn???t end up with 100 records in your example
[04:27:31] Duckily: it depends on what you want to do with the data
[04:28:22] Duckily: lampd1: i mean there???s a big difference between an rdbms
[04:29:04] Duckily: smathy: thanks
[04:34:51] Duckily: rhizome: isn???t that the same as my last gist?
[04:35:37] Duckily: rhizome https://gist.github.com/anonymous/35d806c1b8f8b06775c9
[04:35:43] Duckily: or am i missing something?
[04:36:24] Duckily: it seems like you???re iterating over a new array (less iterations), but whats the difference in output?
[04:38:30] Duckily: rhizome: right, its more efficient
[04:39:09] Duckily: rhizome: the last record is still problematic and needs to be popped off as smathy said
[04:41:14] Duckily: smathy: i don???t think popping off a record will help, i think you still need to deduct 1 for the denom. and just handle the case of 1
[04:43:25] Duckily: rhizome: thanks for the help!