Activity Graph

Page 1 of 3 | Next »


[00:20:12] Wixy: Ping timeout: 252 seconds
[00:44:13] Wixy: has joined #RubyOnRails
[00:44:23] Wixy: Client Quit


[23:47:46] Wixy: has joined #RubyOnRails
[23:48:26] Wixy: Hey all. Where am I suppose to put a file with config such as possible values for languages (en_US en_UK es_ES etc)?
[23:48:35] Wixy: supposed*


[00:26:27] Wixy: Ping timeout: 240 seconds
[01:41:00] Wixy: has joined #RubyOnRails
[04:07:08] Wixy: Read error: Connection reset by peer
[04:07:16] Wixy: has joined #RubyOnRails
[04:09:12] Wixy: Client Quit


[19:56:16] Wixy: has joined #RubyOnRails
[19:57:07] Wixy: Does Rails support upserts? I want to create or update a record in an atomic way, or else just replace it, I'll provide all attributes again. The thing is I want to do it in one statement only
[20:08:26] Wixy: Inside, yeah, but not if there's one builtin
[20:08:57] Wixy: weird, it's really useful in so many use cases
[20:09:24] Wixy: not sure about MySQL but PosgreSQL has upserts
[20:11:26] Wixy: https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Fjesjos%2Factive_record_upsert
[20:14:02] Wixy: https://github.com/stevemao/left-pad
[20:14:05] Wixy: that leftpad?
[20:23:07] Wixy: I didn't know that story


[03:18:55] Wixy: has joined #RubyOnRails
[03:20:29] Wixy: Hi all! I have a "has_one :foo, through: :bar" and a "belongs_to :bar, polimorphic: true". Buy when I run annotate I get that through is not a valid key (Unknown key: :through)
[03:20:30] Wixy: Any idea?
[03:21:42] Wixy: https://guides.rubyonrails.org/association_basics.html#the-has-one-through-association
[03:21:59] Wixy: I don't see any difference in my code
[03:22:10] Wixy: except bar is polymorphic
[03:29:46] Wixy: never mind, I was missing a ":"
[03:36:24] Wixy: Quit: Leaving
[07:17:41] Wixy: has joined #RubyOnRails
[07:18:20] Wixy: Hey. Is there a known bug in Rails 5 regarding migrations add_index with order? My schema.rb is missing the order of my indexes for some reason
[07:31:50] Wixy: add_index :foos, :bar, order: {created_at: :desc}
[07:32:05] Wixy: that line creates an index but the order is ignored
[07:46:46] Wixy: Ping timeout: 250 seconds
[14:56:20] Wixy: has joined #RubyOnRails
[15:07:16] Wixy: Hey. I have something similar to "add_index :foos, :bar, order: {created_at: :desc}" for Postgresql, but the ordering is completely ignored in schema.rb. Is it a bug on Rails 5?
[15:29:11] Wixy: Quit: Leaving


[17:53:57] Wixy: has joined #ruby
[17:53:59] Wixy: has joined #ruby
[17:53:59] Wixy: Changing host
[18:25:04] Wixy: Read error: Connection reset by peer
[18:25:24] Wixy: has joined #ruby
[19:07:33] Wixy: has joined #ruby
[20:57:04] Wixy: Ping timeout: 260 seconds
[21:34:25] Wixy: has joined #ruby
[21:47:14] Wixy: Quit: Leaving


[04:44:29] Wixy: has joined #ruby
[04:48:00] Wixy: Client Quit


[16:29:21] Wixy: has joined #ruby
[16:30:21] Wixy: Hey people, I'm getting a json response from an api (awfully documented) that looks like this
[16:30:38] Wixy: {timezone: "EDT", end: 1467379800, start: 1467360000, gmtoffset: -14400}
[16:30:49] Wixy: It's a timestamp, but I'm not sure how to read it
[16:31:00] Wixy: how could the offset be -14400?
[16:33:03] Wixy: any idea?
[16:35:09] Wixy: the timestamps are second, that's a fact
[16:35:15] Wixy: but I'm not sure about the timezone
[16:36:09] Wixy: but how did you get that from the response??
[16:36:24] Wixy: 144 / 60 is not 4
[16:36:36] Wixy: well, that wouldn't even make sense
[16:36:40] Wixy: maybe 14400?
[16:36:48] Wixy: I see, 14400/3600
[16:37:14] Wixy: yeah, then it's an offset, in seconds for whatever reason lol
[16:37:51] Wixy: well, I think it was Venezuela which had -3:30 or similar, wasn't it?
[16:38:41] Wixy: thanks Papierkorb
[16:45:53] Wixy: Friday July 01, 2016 09:30:00 :)
[16:46:54] Wixy: is there any way to parse a timestamp with timezone? Something like Time.at 19042190832, but with timezone
[16:47:49] Wixy: I'm not using rails, it's pure ruby
[16:48:00] Wixy: well, I can include that lib in particular, I'll have a look
[16:49:45] Wixy: toretore, the timezone (gtmoffset) is in a previous message, -14400
[16:50:35] Wixy: Time.at(1467360000, -14400) => Friday July 01, 2016 09:30:00
[16:50:41] Wixy: something like this, toretore ^
[16:51:23] Wixy: yeah, I know that. but I'm trying to parse a timestamp from an API I can't change :/
[16:52:26] Wixy: makes sense :P
[16:57:04] Wixy: well, not exactly because Time.at will interpret the time with your local timestamp
[16:57:16] Wixy: err, timezone *
[16:57:58] Wixy: so you have to add the offset (-14400) and probably your local offset or whatever, I'll try
[17:04:41] Wixy: toretore, it's wrong, the answer is this I believe: 2016-07-01 09:30:00 -0400
[17:04:48] Wixy: that should be the result
[17:05:18] Wixy: or the equivalent in your local time
[17:29:24] Wixy: I couldn't make it work either -.-
[17:52:13] Wixy: Ping timeout: 252 seconds
[18:30:42] Wixy: has joined #ruby
[18:47:34] Wixy: has left #ruby: ("Leaving")


[20:14:08] Wixy: has joined #ruby


[15:11:33] Wixy: has joined #RubyOnRails
[22:12:08] Wixy: Quit: Leaving


[16:46:42] Wixy: has joined #RubyOnRails
[16:47:48] Wixy: Hey. Is it possible to define dynamic controller names in routes? For example: get '/v:api/:processor/:handler' => '#{processor}/v#{api}/#{handler}#handle'
[19:46:58] Wixy: i4, wtf? it sucks
[19:48:06] Wixy: i==5 or i == 10 or i==15 or i==20 or i==25 --> if i % 5 == 0
[19:48:10] Wixy: same for 1, 6, 11, etc
[19:48:45] Wixy: 24.times do |i| i=i+1 --> 1.upto(24) do |i|
[19:49:17] Wixy: also I don't know why you have two .times and not just one, i4
[19:49:59] Wixy: fox_mulder_cp, what do you want to do?
[19:50:06] Wixy: give an example
[19:50:49] Wixy: i4, I meant 1.upto(25) btw, no 24
[19:51:21] Wixy: fox_mulder_cp, why do you need that?
[19:52:00] Wixy: you need to add \u just before numbers?
[19:52:04] Wixy: I didn't get it
[19:54:23] Wixy: fox_mulder_cp, why do you need to add \u before numbers? what for?
[19:55:30] Wixy: "/var/clients/client#{self.client.id}/#{self.name}.#{self.client.reseller.domain_zones.where(group: 2).first.name}"
[19:55:35] Wixy: try this ^
[19:56:16] Wixy: no difference I believe, it's just easier to read
[19:56:22] Wixy: what do you get with that line?
[19:57:02] Wixy: what is client.id?
[19:57:05] Wixy: what class is it?
[19:57:12] Wixy: are you sure?
[19:57:24] Wixy: you had .to_i previously
[19:57:42] Wixy: try self.client.id.class
[19:57:49] Wixy: and see what you get
[19:59:16] Wixy: is it a column on a database? fox_mulder_cp
[20:00:19] Wixy: i4, why not?
[20:02:00] Wixy: fox_mulder_cp, try this just in case "/var/clients/client#{1}/#{self.name}.#{self.client.reseller.domain_zones.where(group: 2).first.name}"
[20:02:48] Wixy: i4, that's what you get with i % 5 == 0, it returns true if i==5 or i==10 or ...
[20:03:56] Wixy: i4, i==5 or i == 10 or i==15 or i==20 or i==25
[20:03:59] Wixy: this is not true for i=1
[20:04:28] Wixy: neither is i%5==0
[20:06:34] Wixy: it surely does, you're doing something wrong somewhere else
[20:06:37] Wixy: show your code
[20:14:14] Wixy: what's the expected result?
[20:15:15] Wixy: you need to group 5 images within a div?
[20:15:30] Wixy: every 5 images
[20:16:26] Wixy: paste the result you're getting with this code
[20:21:13] Wixy: now the two condicions are the same
[20:21:20] Wixy: don't do that!
[20:23:03] Wixy: https://gist.github.com/anonymous/99e782486e52ba75bc97
[20:23:11] Wixy: check the comment there
[20:23:37] Wixy: i4, you shouldn't like that code
[20:29:32] Wixy: smathy, hey, do you happen to know if it's possible to define dynamic controller names in routes?
[20:29:36] Wixy: For example: get '/v:api/:processor/:handler' => '#{processor}/v#{api}/#{handler}#handle'
[20:29:48] Wixy: or something similar to achieve that
[20:30:30] Wixy: http://joshsymonds.com/blog/2012/05/22/dynamic-routing-with-rails/
[20:30:35] Wixy: I've found this post from 2012
[20:30:52] Wixy: it's kind of the same but I don't have a predefined array with processors
[20:32:47] Wixy: and I would need all API versions beforehand, I can't use that
[20:36:53] Wixy: i4, I don't know what you're talking about, it's plain ruby
[20:37:09] Wixy: I wrote that and executed it using pry just to check it worked
[20:37:23] Wixy: it's not erb, haml, slim or anything else
[20:52:09] Wixy: Quit: Leaving


[00:50:37] Wixy: Quit: Leaving


[23:24:26] Wixy: has joined #RubyOnRails


[04:07:16] Wixy: has joined #RubyOnRails
[04:09:03] Wixy: Hey there! how do you implement a daily report? I want to send my users a report every day, to all of them, but I need to access the models and mailer views, though I believe it's not exactly part of the rails app
[04:09:10] Wixy: what's your opinion? how would you do this?
[04:10:59] Wixy: thanks, I'll check that in a sec
[04:11:00] Wixy: any other idea?
[05:36:26] Wixy: Quit: Leaving


[14:34:04] Wixy: has joined #RubyOnRails
[14:35:07] Wixy: Hello there! I have this association 'belongs_to :source, class_name: "Page"' but when I use it, rails uses table "source" and crashes with error missing: missing FROM-clause entry for table "source"
[14:35:23] Wixy: the table is "pages", not "source" (not even "sources". What is wrong?
[14:46:46] Wixy: hwo do you rename a belongs_to association? I have a table "pages" and a model that belongs to pages, but I want to call the association "source"
[15:40:35] Wixy: has joined #ruby
[15:40:44] Wixy: Hey, check this please: https://gist.github.com/b2333cf48ed584b1a4b9
[15:41:20] Wixy: how do you do so that method "d" of class A has access to the overriden constant CON?
[15:41:33] Wixy: I want B.new.d to print [1,2,3,4]
[15:42:17] Wixy: I think I tried that already, let me double check
[15:43:53] Wixy: but I want to change CON in B, not the method, shevy
[15:44:40] Wixy: self.class::CON works perfect!
[15:46:00] Wixy: adaedra, any idea?
[16:03:57] Wixy: Ping timeout: 265 seconds


[03:33:46] Wixy: has joined #RubyOnRails
[03:34:18] Wixy: Hey guys! Rails (develop environment) is appending a hash code to my assets. as if it is compiling (and even caching) them
[03:34:31] Wixy: what config should I be looking for in order to disable this?
[03:34:52] Wixy: I can't find what is wrong, I'll gist my config in a moment
[03:36:09] Wixy: Rails v4.2.1, config: https://gist.github.com/anonymous/e524861596bfef8e570d
[03:36:49] Wixy: should I put config.assets.digest = false ?
[03:37:56] Wixy: not sure, I don't know if "digest" is causing the hash at the end of the assets or what
[03:39:18] Wixy: right now I'm getting this error: Asset filtered out and will not be served: add `Rails.application.config.assets.precompile += %w( delete.png )` to `config/initializers/assets.rb`
[03:39:29] Wixy: but I have this: Rails.application.config.assets.precompile += %w( vendor )
[03:39:31] Wixy: weeeeird!
[03:39:50] Wixy: sevenseacat, I put digest = false but I'm getting the error above, so I couldn't check if it fixed the problem
[03:40:19] Wixy: sevenseacat, it shouldn't be needed to add delete.png to precompile, I added the whole vendor dir!
[03:40:55] Wixy: do I really need to add EVERY image in my vendor folder? crazy
[03:41:41] Wixy: I guess I can add the folder to the precompile path or something?
[03:43:26] Wixy: it seems vendor images are not
[03:44:36] Wixy: I didn't get it
[04:32:50] Wixy: Quit: Leaving
[21:11:21] Wixy: has joined #RubyOnRails
[21:12:10] Wixy: is it only here that in development mode assets paths are something like this? /assets/application-59595f88e6c6d47c223ae92f2796f864.css
[21:12:39] Wixy: I think by default in develop mode it should be /assets/application.css
[21:12:42] Wixy: can anyone confirm?
[21:20:06] Wixy: I don't think I compiled my assets, but anyway, "bundle exec rake assets:clean" should fix it, doesn't it?
[21:20:13] Wixy: I'm still getting the fingerprint after the file name
[21:20:15] Wixy: any idea?
[21:24:44] Wixy: my public folder is empty apart from the 4xx.html error pages and favicon, arup_r
[21:32:24] Wixy: "config.assets.digest = false" fixed the problem, what it's weird since it is enabled by default in new rails apps
[21:32:38] Wixy: do you have digest enabled in develop? did you change it?
[21:41:32] Wixy: Quit: Leaving


[06:26:17] Wixy: has joined #RubyOnRails
[06:30:50] Wixy: Client Quit


[04:06:30] Wixy: has joined #RubyOnRails
[04:07:12] Wixy: has left #RubyOnRails: ()


[16:24:51] Wixy: Hi! I want to add an index to a table so I can get a list of channels by score desc. what index would this be?
[16:25:26] Wixy: add_index :channel, ???, order: { score: :desc }
[16:25:36] Wixy: :channels I meant


[00:00:45] Wixy: Hey guys. I'm not sure if I can do this here, is there a better channel to hire programmers? We're looking for people to work on rails projects? pm your github username! we're hiring! :)
[00:06:17] Wixy: I'm not sure if I can do this here, is there a better channel to hire programmers?
[00:06:18] Wixy: We're looking for people to work on rails projects? pm your github username! we're hiring! :)
[00:07:00] Wixy: oh, could be


[15:29:32] Wixy: how do you force gem to install the gems in the system instead of installing them on my home dir?
[15:30:24] Wixy: I wonder why it's not in the man page
[15:32:08] Wixy: thanks guys


[03:45:35] Wixy: is it possible to render a view from a view?
[03:45:44] Wixy: I'm not talking about a partial, but a view
[03:52:55] Wixy: yep, I'm aware of that
[03:53:17] Wixy: I was just wondering if there's a way to render a whole view witin another view
[03:53:29] Wixy: without moving to a partial of course
[03:54:49] Wixy: it tries to load a partial
[03:54:59] Wixy: so it says "foo/_bar" does not exist
[03:55:23] Wixy: (using_ render "foo/bar")
[03:56:23] Wixy: yep, same problem
[03:56:30] Wixy: it always add _ before bar


[12:57:07] Wixy: elaptics, not alllllll of them, just product.title, product.description and category.name
[12:57:46] Wixy: but yeah, the solution for all of them would work
[12:58:39] Wixy: I guess the model should be like this: Translation(value, language, type, translatable)
[12:59:03] Wixy: because I didn't know it :)
[12:59:25] Wixy: "Andy Henson andyh authored 2 years ago"
[12:59:30] Wixy: err, I'm not sure it's a good idea
[12:59:50] Wixy: 9 months
[12:59:54] Wixy: it's better
[13:01:02] Wixy: oh, I see, it creates a new table for every column you want to translate
[13:01:13] Wixy: it's kind of.. ugly
[13:01:38] Wixy: you don't translate columns, you translate text
[13:02:54] Wixy: duplicate text Demerzel
[13:03:20] Wixy: oh, wait, I know what you mean
[13:03:53] Wixy: ok, you've a good point there. I don't need to navigate from translation to the product/category actually
[13:03:59] Wixy: so there's no need for the polymorphic association
[13:04:18] Wixy: right, I think it's better than 3 new tables
[13:06:16] Wixy: supporing products title, description and categories' names in many languages
[13:08:14] Wixy: nope, no reason
[13:09:53] Wixy: what? it's a tool online to translate text?
[13:10:06] Wixy: I'm reading about it, wait a sec
[13:10:36] Wixy: I hope it's cached locally :P
[13:14:51] Wixy: ok, I'll read more and decide what's more appropiate for this case