oded

Activity Graph

Page 1 of 2 | Next »

2018-05-03

[06:14:12] oded: Quit: Konversation terminated!

2018-04-29

[16:08:22] oded: has joined #RubyOnRails
[16:09:01] oded: How do I use .coffee.erb with webpacker? I have installed both coffee & erb loader, and I added .coffee.erb to the extensions list in webpacker.yml
[16:10:17] oded: The last part was an attempt on my side, didn't work...

2018-02-04

[18:41:04] oded: Quit: Konversation terminated!

2018-01-28

[11:55:53] oded: has joined #RubyOnRails
[11:56:55] oded: Hey, I have a model with default_scope containing a where and a joins. When I join with this model, the query contains the where but not the joins. Any ideas?
[12:02:19] oded: https://gist.github.com/odedniv/d3667f0538a026bc733a74497f85e933

2017-11-08

[11:35:28] oded: has joined #ruby
[11:35:46] oded: has joined #RubyOnRails
[11:36:33] oded: Is "ActionCable.server.connections" supposed to return all the connections to the Redis server? Or only to the current webserver worker?
[11:44:01] oded: How am I supposed to get all ActionCable connections?
[15:20:30] oded: Quit: Konversation terminated!

2017-11-05

[13:16:24] oded: has joined #ruby
[13:17:25] oded: has joined #RubyOnRails
[13:18:25] oded: Hello, is it possible to handle an app shutdown on Rails? I tried using trap I get "`lock': can't be called from trap context" when trying to execute SQL
[13:30:06] oded: How do I perform cleanup then?
[13:31:50] oded: I have setup actioncable channel that logs in the DB active users in specific pages
[13:32:19] oded: There's a leakage when the server shuts down (which I think nginx does from time to time)
[13:32:34] oded: #unsubscribed is never called
[13:34:11] oded: halogenandtoast: how do I know what to cleanup? I need some way of mapping records to connections and check which records' connections have been closed
[13:35:03] oded: (I mean how do I cleanup on boot)
[13:35:41] oded: What? No... how would that help me?
[13:36:04] oded: Every time an app restarts all my counters are reset?
[13:38:27] oded: https://gist.github.com/odedniv/ae64a2d2595feaabe4ad1e53f60f431d
[13:38:46] oded: I would love to know of a better & safer way to do what I'm doing in that gist
[22:13:40] oded: Quit: Konversation terminated!

2017-10-25

[12:20:57] oded: has joined #RubyOnRails
[15:26:48] oded: Ping timeout: 240 seconds

2017-10-17

[20:08:39] oded: has joined #ruby
[20:33:43] oded: Quit: Konversation terminated!

2017-10-11

[09:42:26] oded: has joined #RubyOnRails
[09:44:24] oded: Security question: why does Rails routing handle '..' the way it does? In what scenario will the requester *intentionally* have that in the request? (I can think of many bad scenarios where the requester *didn't* intentionally have that in the request)
[09:54:24] oded: matthewd: requesting "http://domain.com/path/../another_path" make the router serve "http://domain.com/another_path"
[10:16:35] oded: matthewd: that's so weird. I understand that in filesystems I do not in HTTP URLs. I can't think of one scenario where this is used on purpose. The problem is not just with escaping the root, for example we are making a tool that creates a GitHub commit message (the ones CIs do on PRs). The API is expecting the commit's SHA-1 so we take that as a parameter, this can easiliy be exploited to fuck up or get data from the GitHub repo
[11:04:03] oded: workmad3: :) do you have any clue why the RFC would state that? What good can come of it?
[11:41:41] oded: Ping timeout: 240 seconds

2017-10-04

[07:41:49] oded: has joined #ruby
[09:54:28] oded: Quit: Konversation terminated!

2017-10-02

[21:52:29] oded: has joined #ruby
[22:00:30] oded: Quit: Konversation terminated!

2017-07-30

[12:40:35] oded: has joined #ruby
[12:40:51] oded: has joined #RubyOnRails
[12:41:40] oded: Is there a known issue with unsubscribing and quickly subscribing to an ActionCable channel? It seems it doesn't resubscribe
[13:38:04] oded: Anybody here?
[13:57:59] oded: Tried with multiple JS frameworks including actioncable-js (I'm on AngularJS)
[13:59:57] oded: On all of them I see that if I reuse the consumer, unsubscribing and quickly subscribing only shows the unsubscribe event in Rails logs (tried with async and redis)
[14:01:14] oded: When I switch page again which causes another unsubscribe, I see a null reference error inside rails (because it wasn't subscribed), and the following subscribe works
[14:01:47] oded: (Every AngularJS page switch I unsubscribe when old view gets destroyed and subscribe from new view)
[15:01:24] oded: naftilos76: are you trying to do many to many relation? In which case you need another table
[17:55:50] oded: Quit: Konversation terminated!

2017-07-22

[06:39:16] oded: Quit: Konversation terminated!

2017-07-20

[06:36:31] oded: has joined #ruby

2017-07-14

[07:45:01] oded: has joined #ruby
[09:00:01] oded: Quit: Konversation terminated!

2017-07-13

[08:54:15] oded: has joined #ruby
[12:14:36] oded: Ping timeout: 240 seconds
[12:15:42] oded: has joined #ruby
[13:07:06] oded: Ping timeout: 240 seconds

2017-07-11

[12:13:38] oded: has joined #ruby
[12:16:08] oded: Remote host closed the connection
[12:16:34] oded: has joined #ruby
[13:07:16] oded: Quit: Konversation terminated!

2017-07-10

[14:43:55] oded: has joined #ruby
[20:24:04] oded: Quit: Konversation terminated!

2017-07-06

[08:10:11] oded: has joined #ruby
[11:34:42] oded: Remote host closed the connection

2017-06-13

[04:28:24] oded: Quit: Konversation terminated!

2017-06-11

[11:18:11] oded: has joined #ruby

2017-06-02

[09:23:53] oded: has joined #ruby
[11:39:16] oded: Quit: Konversation terminated!

2017-05-18

[08:36:24] oded: Quit: Konversation terminated!

2017-05-14

[08:16:39] oded: Quit: Konversation terminated!
[14:42:55] oded: has joined #ruby

2017-05-12

[14:34:14] oded: Remote host closed the connection
[14:35:10] oded: has joined #ruby

2017-05-11

[10:14:19] oded: has joined #ruby

2017-05-10

[07:26:49] oded: Remote host closed the connection

2017-05-06

[11:31:12] oded: has joined #ruby

2017-04-18

[08:45:54] oded: Quit: Konversation terminated!

2017-04-17

[14:45:59] oded: How can I convert a BigDecimal to string without leading zeroes (I don't want to round it though)
[14:46:48] oded: BigDecimal("30").something => "30" & BigDecimal("30.5").something => "30.5"
[14:48:29] oded: did not expect it to be so hard
[14:50:15] oded: havenwood: I don't want to round it, and to_f doesn't remove the leading zero
[14:50:55] oded: I don't even understand why it put it there
[14:51:20] oded: it's like a special case because nothing would be added to it if it wasn't a round number
[14:55:27] oded: ljarvis: that has failed
[14:56:12] oded: ljarvis: why do you need a better example?
[14:56:19] oded: require "bigdecimal"; BigDecimal("30").to_s("F")
[14:56:46] oded: >> require "bigdecimal"; BigDecimal("30.5").to_s("F")
[14:56:50] oded: >> require "bigdecimal"; BigDecimal("30").to_s("F")
[14:56:58] oded: yes, trailing :)
[14:57:05] oded: sorry about that
[14:57:20] oded: I don't if it's a round number
[14:57:36] oded: right, did that with a sub but that looks better :)
[15:04:17] oded: thanks people

2017-04-16

[17:28:06] oded: has joined #ruby

2017-04-12

[15:15:35] oded: has joined #ruby
[18:01:38] oded: Quit: Konversation terminated!

2017-04-06

[12:55:18] oded: Quit: Konversation terminated!

2017-04-04

[19:59:17] oded: has joined #ruby
[19:59:17] oded: has joined #RubyOnRails

2017-04-03

[07:41:10] oded: has joined #RubyOnRails
[07:41:11] oded: has joined #ruby
[16:08:53] oded: Quit: Konversation terminated!

2017-03-24

[14:52:01] oded: Quit: Konversation terminated!

2017-03-23

[13:46:29] oded: has joined #RubyOnRails
[14:11:41] oded: Quit: Konversation terminated!
[16:41:08] oded: has joined #RubyOnRails
[16:41:12] oded: has joined #ruby

2016-07-29

[10:58:07] oded: Quit: Konversation terminated!

2016-07-26

[15:27:32] oded: has joined #RubyOnRails
[15:29:09] oded: I want to change my production cookies to support multiple subdomains, what's the best approach?

2016-05-24

[09:15:47] oded: has joined #RubyOnRails
[17:12:41] oded: Quit: Konversation terminated!

2016-03-31

[00:23:02] oded: Ping timeout: 260 seconds
[06:39:25] oded: has joined #RubyOnRails
[18:10:28] oded: Quit: Konversation terminated!

2016-03-30

[00:34:45] oded: Ping timeout: 244 seconds
[07:13:09] oded: has joined #RubyOnRails

2016-03-29

[14:41:16] oded: has joined #RubyOnRails

2016-02-15

[01:22:56] oded: Read error: Connection reset by peer
[01:23:14] oded: has joined #RubyOnRails
[02:59:48] oded: Ping timeout: 248 seconds

2016-02-14

[04:36:20] oded: Ping timeout: 248 seconds
[08:10:08] oded: has joined #RubyOnRails

2016-02-13

[15:19:51] oded: has joined #RubyOnRails

2016-02-04

[11:29:02] oded: has joined #RubyOnRails
[11:29:19] oded: Client Quit
[11:29:41] oded: has joined #RubyOnRails
[15:05:22] oded: Quit: Konversation terminated!

2016-02-02

[02:26:36] oded: Ping timeout: 245 seconds
[09:50:16] oded: has joined #RubyOnRails
[18:45:13] oded: Quit: Konversation terminated!

2016-02-01

[13:56:21] oded: has joined #RubyOnRails

2016-01-16

[05:11:25] oded: Ping timeout: 245 seconds
[07:55:51] oded: has joined #RubyOnRails
[13:58:08] oded: Quit: Konversation terminated!

2016-01-15

[11:50:38] oded: has joined #RubyOnRails
[20:50:47] oded: Ping timeout: 246 seconds
[22:27:21] oded: has joined #RubyOnRails

2016-01-02

[18:22:59] oded: has joined #RubyOnRails
[19:54:33] oded: Quit: Konversation terminated!

2015-11-13

[12:42:25] oded: Quit: Konversation terminated!

2015-11-12

[09:26:26] oded: Ping timeout: 240 seconds
[10:08:21] oded: has joined #RubyOnRails
[10:23:09] oded: Ping timeout: 252 seconds
[10:42:31] oded: has joined #RubyOnRails
[14:50:21] oded: Ping timeout: 246 seconds
[14:50:29] oded: has joined #RubyOnRails

2015-11-11

[11:19:30] oded: has joined #RubyOnRails

2015-11-09

[04:58:35] oded: has joined #RubyOnRails
[09:20:57] oded: Quit: Konversation terminated!

2015-11-08

[00:02:06] oded: Ping timeout: 240 seconds

2015-11-07

[01:37:15] oded: Ping timeout: 260 seconds
[15:27:29] oded: has joined #RubyOnRails
[15:37:50] oded: Ping timeout: 240 seconds
[15:39:51] oded: has joined #RubyOnRails
[17:08:42] oded: Quit: Konversation terminated!
[17:09:07] oded: has joined #RubyOnRails

2015-11-06

[05:29:57] oded: Ping timeout: 255 seconds
[13:53:22] oded: has joined #RubyOnRails
[13:53:32] oded: dionysus69: a bit late, but you can use scopes in the model and a constant stating which scopes can be used, and then the controller iterates over that constant. so it's all under the model's control
[13:54:19] oded: gday to u 2
[13:55:39] oded: in controller: Product::FILTERS.each { |filter| @products = @products.send(filter, params[filter]) if filter }
[13:56:29] oded: in model: FILTERS = [:giftbox, ...]; scope :giftbox, -> (param) { ... }; or def self.giftbox(param)
[21:21:06] oded: Ping timeout: 240 seconds
[21:56:54] oded: has joined #RubyOnRails
[22:06:21] oded: Ping timeout: 244 seconds
[22:43:19] oded: has joined #RubyOnRails

2015-11-05

[12:10:29] oded: why does it have production/ infront of it? it works without
[12:12:39] oded: I can't believe it took us so long to see that difference
[12:13:09] oded: grep production -r config
[12:13:34] oded: oh yeah, so in production (when you precompile) it has a different prefix than development
[12:13:44] oded: restart the server
[12:13:56] oded: after changing files under config/ you have to restart
[12:14:08] oded: (if production, touch tmp/restart.txt or whatever)
[12:14:42] oded: try `grep production -r config` to check if there are any more like this
[12:16:18] oded: hash.reject! { |k, v| v.nil? }
[12:16:53] oded: dionysus69: try on app/
[12:17:48] oded: skullcrasher: oops I was testing in IRB and not rails console so I thought this method doesn't exist, it's from ActiveSupport
[12:18:22] oded: dionysus69: when I said restart the server I meant recompile again :)
[12:21:00] oded: that's how I compile it too. can you remove public/assets before you do?
[12:21:40] oded: is that on the same server you ran the grep command?
[12:22:40] oded: not sure what initialize_on_precompile does, but https://github.com/railsware/js-routes/issues/79
[12:23:33] oded: oh I know what it does, it runs the rails initializations... stupid me
[12:24:03] oded: rails 4?
[12:24:37] oded: I don't have it
[12:25:00] oded: can you gist your config/environments/production.rb and config/application.rb?
[12:32:39] oded: dionysus69: what's in here: ENV['FOG_DIRECTORY']
[12:33:54] oded: avril14th: you can change spec/spec_helper.rb if you use RSpec, or you can add a ruby file in config/initializers and check RAILS_ENV in it.
[12:34:22] oded: dionysus69: so the difference is initialize_on_precompile?
[12:34:50] oded: oh you were looking at the old css file...
[12:35:28] oded: each time you precompile new files with new hashes gets generated, it doesn't remove the old files. You need to look at the new HTML and go to the relevant CSS file
[12:36:04] oded: avril14th: no that doesn't belong in an initializer, that belongs to spec_helper
[12:36:23] oded: or a file spec_helper requires, sec I'll show you what I do
[12:38:24] oded: avril14th: https://gist.github.com/odedniv/c9a24466713ce5fa4f33
[12:38:51] oded: Just require 'database_cleaner' from console and run DatabaseCleaner.start
[12:38:57] oded: I mean clean
[12:39:19] oded: they should do it automatically
[12:40:02] oded: hmm you can add an initializer, use config/environments/development.rb, or use .irbrc though I doubt it will work there
[12:41:19] oded: dionysus69: I think it uses the manifest file in public/assets to decide what file to use. is you HTML an asset or app/views?
[12:42:58] oded: is it all on your development machine?
[15:07:09] oded: Ping timeout: 246 seconds
[15:18:42] oded: Read error: Connection reset by peer
[15:18:42] oded: has joined #RubyOnRails
[17:07:17] oded: has joined #RubyOnRails
[20:18:00] oded: EllisTAA: I suggest JBuilder
[20:18:34] oded: didn't find much use in rails-api really
[20:20:09] oded: you can also use rabl but it has performance issues
[20:27:04] oded: tubbo: ams goes completely the wrong way... this is the responsibility of the view. ofcourse raw ruby would be faster :)
[20:28:46] oded: and why irrelevant? I said I'm not using rails-api, I just have controllers with Jbuilder views which together creates an API application
[20:29:52] oded: that is correct, just wanted to let him know it can be done without :)
[20:30:57] oded: also, looking at the readme I see bad suggestions, such as remove protect_from_forgery "because you're not using cookies", or use AMS
[20:32:22] oded: generating JSON from the data is equivalent to generating HTML from the data, and so it goes under app/views. Also you find yourself neading params within the view (because they can specify how to generate the view) which also makes sense when it's not just a class outside the application context
[20:33:08] oded: well I created an API for use from both clients and angular JS for exmaple, which also makes use of this protection
[20:34:46] oded: and I also use cookies to keep the session, even for a non-human client. I don't see a reason to send something like the auth key in the params of every request (that's what the HTTP headers are for)
[20:36:01] oded: tubbo: if you design your api around resources (restful), you sometimes want to send resources with their children because their children might not make sense on their own, or want the resource with some aggregation on its children
[20:36:45] oded: it's just having a client that keeps a cookie jar... any http client can do it
[20:37:35] oded: tubbo: so the problems you will find with that is that you only need it in specific occasions, and the rest of the situation it's just a big waste
[20:37:50] oded: for example you need it in show and not in index, or on specific occasions of show usage
[20:39:33] oded: I thought you said your API is just an interface to your objects
[20:40:24] oded: but it's random objects you create based on your users, the API should be generic and you shouldn't need to add an action for each scenario
[20:41:02] oded: say you have posts, they have comments they have votes. one time you need comments, one time you need votes, one time both and one time none. that's 4 actions/objects
[20:42:08] oded: so you specify a GET param, and pass it from the controller, which is what I said - the view needs the parameters
[20:43:20] oded: tubbo: what I do is much simpler to implement and to use, I provide the minimum amount of data (basically what comes without any additional queries), and the user can specify an include param that the controller knows and renders the view with them
[20:44:31] oded: your controller needs to get from the model what it needs and render something from it, the model can have a MySQL backend or another HTTP API as a backend. The model is basically an interface to your data (SQL is also an API)
[20:44:44] oded: tubbo: don't you like that solution?
[20:45:46] oded: well I couldn't find a proper convention, so I made one up... but it's not that much far fetched, GET params are to specify what you want to receive
[20:46:41] oded: shathoma: how well are you acquainted with relational databases?
[20:47:50] oded: tubbo: you can have partials or render the same file or use view inheritance (app/application/show.json.jbuilder)
[20:48:13] oded: shathoma: you should learn about foreign keys, maybe use an SQL training tool like sqlzoo
[20:48:22] oded: http://sqlzoo.net/
[20:49:24] oded: shathoma: the question you need to ask yourself is this: how many times can an employee quit, and can the same "quit" be done by multiple employee (yeah that doesn't make sense)
[20:50:09] oded: tubbo: you'll either need infinite amount of actions or have severe performance issues this way
[20:51:51] oded: tubbo: I guess you don't like discussions :x
[20:52:26] oded: if an employee can quit many times then an employee has_many quits and a quit belongs_to employee
[20:52:46] oded: shathoma: change quit to employeeterm I guess
[20:53:35] oded: was this method recently added?
[20:53:58] oded: shathoma: great !
[20:54:33] oded: sucks for you Radar
[20:54:48] oded: what kind of rails programmer starts work at 8:30 :P
[20:55:12] oded: that is true
[20:55:41] oded: afk. hnanon if this code was just added you might want to restart your server
[22:08:26] oded: lol Aeyrix
[22:08:51] oded: bvbrandon: you can always find a better boss