Silex

Activity Graph

Page 1 of 4 | Next »

2019-05-15

[11:20:41] Silex: has joined #RubyOnRails
[11:21:36] Silex: Hello, since rails 5.2 actionmailer methods don't take parameters but extract it all from `params`, while earlier it was parameters... should I always use params[] like in the examples? is there a rationale for it?
[11:22:11] Silex: intuitively I feel using params[] is more flexible but there are maybe drawbacks
[11:26:26] Silex: has joined #ruby
[11:39:43] Silex: tbuehlmann: hum, then https://guides.rubyonrails.org/v5.1/action_mailer_basics.html vs https://guides.rubyonrails.org/v5.2/action_mailer_basics.html is a bit misleading
[11:40:11] Silex: under "2.1.2 Edit the Mailer"
[11:40:27] Silex: but alright, thanks for clarifying
[11:53:16] Silex: catphish: https://blog.appsignal.com/2018/06/05/redo-retry-next.html should help you
[11:54:08] Silex: catphish: looks like you could "raise RedirectError" and retry yeah
[11:54:38] Silex: catphish: but it's likely that whatever you are using can follow redirects with a big of config
[11:55:12] Silex: also I don't see how retrying the exact same thing will not yield another redirect
[11:56:37] Silex: This example http://ruby-doc.org/stdlib-2.6.3/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-Following+Redirection shows how to follow redirects
[11:56:57] Silex: it uses recursivity
[11:59:43] Silex: catphish: instead of throw/catch you could a simple loop { response = fetch(url); url = response.location if response.is_redirect?; handle_response(response); break }
[12:00:24] Silex: that is, fetch until there's no more redirect and then handle the response and break the loop
[12:01:32] Silex: I forgot a "redo" in my example
[12:01:47] Silex: or an "else"
[12:02:44] Silex: this https://stackoverflow.com/questions/6934185/ruby-net-http-following-redirects also has an example with a limit of tries
[12:03:09] Silex: oh wait it's the same example as the doc
[12:05:48] Silex: tbuehlmann: what I'll remember is that params[] is great for "global" parameters that affect all methods, e.g the locale. Named parameters for the specific stuffs
[12:17:13] Silex: Ping timeout: 256 seconds

2019-04-26

[11:46:47] Silex: has joined #ruby
[11:47:14] Silex: has left #ruby: ()
[11:47:22] Silex: has joined #ruby
[12:28:11] Silex: Ping timeout: 256 seconds

2019-04-18

[12:41:57] Silex: has joined #ruby
[14:12:11] Silex: Quit: Page closed

2019-02-06

[16:20:00] Silex: has joined #ruby
[17:08:05] Silex: Ping timeout: 256 seconds

2018-10-03

[09:02:06] Silex: has joined #ruby
[10:21:55] Silex: Ping timeout: 256 seconds

2018-06-06

[12:34:03] Silex: has joined #ruby
[13:10:51] Silex: Doesn't both HTTP.rb and Typhoeus have threading issues?
[13:12:19] Silex: Ah no, HTTP.rb seems thread-safe
[13:14:11] Silex: https://github.com/httprb/http/wiki/Thread-Safety
[16:01:06] Silex: Quit: Page closed

2016-06-22

[07:04:45] Silex: *.net *.split

2016-06-15

[23:12:57] Silex: *.net *.split
[23:19:11] Silex: has joined #ruby
[23:19:13] Silex: has joined #RubyOnRails

2016-04-14

[06:08:45] Silex: *.net *.split

2016-04-13

[18:39:20] Silex: Ping timeout: 252 seconds
[18:53:29] Silex: has joined #ruby
[18:53:31] Silex: has joined #RubyOnRails

2016-04-07

[09:24:14] Silex: I want a route that has share/index share/edit share/update all as _collection_, should I still use "resources :share" ?
[09:25:01] Silex: it's for a complex form where I edit mutiple items at once
[09:25:43] Silex: so far I have resources :share, only: [:index] { collection{ get :edit; post :update }}
[09:25:52] Silex: but that produces weird routes (share_index_path) etc
[09:30:16] Silex: hum, fixed it with a singular resource

2016-03-28

[11:09:15] Silex: has joined #RubyOnRails
[11:09:15] Silex: has joined #ruby
[12:16:16] Silex: Quit: WeeChat 0.4.2
[12:16:54] Silex: has joined #RubyOnRails
[12:16:54] Silex: has joined #ruby
[12:24:53] Silex: Quit: WeeChat 1.4
[12:25:14] Silex: has joined #RubyOnRails
[12:25:14] Silex: has joined #ruby

2016-03-27

[10:12:06] Silex: Quit: WeeChat 0.4.3
[19:24:34] Silex: has joined #RubyOnRails
[19:24:34] Silex: has joined #ruby
[19:26:50] Silex: Client Quit
[19:54:22] Silex: has joined #ruby
[19:54:23] Silex: has joined #RubyOnRails
[19:55:20] Silex: Client Quit
[21:46:34] Silex: has joined #RubyOnRails
[21:46:34] Silex: has joined #ruby
[21:47:14] Silex: Read error: Connection reset by peer
[22:23:03] Silex: has joined #RubyOnRails
[22:23:03] Silex: has joined #ruby
[22:25:26] Silex: Client Quit

2016-02-28

[12:54:33] Silex: Ping timeout: 264 seconds
[13:07:16] Silex: has joined #ruby
[13:07:18] Silex: has joined #RubyOnRails

2016-01-31

[12:25:01] Silex: *.net *.split
[12:28:13] Silex: has joined #ruby
[12:28:16] Silex: has joined #RubyOnRails

2016-01-30

[01:04:04] Silex: *.net *.split
[01:04:51] Silex: has joined #ruby
[01:04:53] Silex: has joined #RubyOnRails

2016-01-17

[22:50:13] Silex: Ping timeout: 250 seconds
[22:50:49] Silex: has joined #ruby
[22:50:51] Silex: has joined #RubyOnRails

2016-01-07

[09:34:43] Silex: any gotcha for rails with ruby 2.3? using rails 4.2.5 & ruby 2.2 atm

2015-12-21

[09:50:03] Silex: *.net *.split
[09:58:00] Silex: has joined #ruby
[09:58:02] Silex: has joined #RubyOnRails

2015-12-15

[10:53:44] Silex: KrzaQ: the name "permutations" looks wrong here
[10:54:25] Silex: also, http://ruby-doc.org/core-2.2.0/Array.html#method-i-permutation
[10:57:56] Silex: I think you want more like a generator
[11:01:32] Silex: hum, actually it can be permutations, but you need to start with a bigger array of all possible elements then
[11:02:23] Silex: [0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3].permutation(4)
[11:02:54] Silex: then each_with_object({}) h[arr.sum] etc
[11:03:19] Silex: basically what you said yeah
[11:03:28] Silex: but, it depends wether you focus on elegance or performance
[11:04:25] Silex: for an array of 16 elements I doubt you'd notice
[11:05:30] Silex: 400 elements is peanuts
[11:06:05] Silex: (or at least I'd believe it is, maybe I'm wrong)
[11:11:39] Silex: hum, you're right it's rather slow
[11:14:10] Silex: interesting example of elegancy vs performance
[11:47:42] Silex: KrzaQ: you can probably get rid of the if somehow
[11:49:39] Silex: hum... actually no
[15:09:53] Silex: KrzaQ: :P

2015-12-14

[08:43:32] Silex: why do yout hink it is bad?
[08:44:00] Silex: anyway, you could make it api.server.com/file?path={path}
[08:47:20] Silex: are you making some sort of file explorer?
[08:47:51] Silex: anyway, api.server.com/file?path=C%3A%5CUsers%5CAndreas%5Csomefile.py
[08:48:08] Silex: (url encode it)
[08:48:22] Silex: and you can use it in params[:path]
[08:50:02] Silex: you can't have '\' in an url
[08:50:24] Silex: you could use forward slashes tho
[08:50:44] Silex: e.g cygwin'ish paths
[08:51:05] Silex: api.server.com/file/c/Users/Andreas/receiver.py
[08:51:46] Silex: but that requires a bit of manipulation before you can use straight on the host
[08:52:31] Silex: it depends whether url-prettyness is really important or not

2015-12-02

[15:36:14] Silex: *.net *.split
[16:28:43] Silex: has joined #RubyOnRails
[16:28:47] Silex: has joined #ruby
[16:32:39] Silex: Ping timeout: 245 seconds
[16:47:31] Silex: has joined #ruby
[16:47:56] Silex: has joined #RubyOnRails

2015-11-29

[22:18:45] Silex: *.net *.split
[22:49:44] Silex: has joined #ruby
[22:49:46] Silex: has joined #RubyOnRails

2015-11-26

[19:01:44] Silex: *.net *.split

2015-11-19

[02:23:42] Silex: Ping timeout: 250 seconds
[02:24:26] Silex: has joined #ruby
[02:24:28] Silex: has joined #RubyOnRails

2015-11-18

[14:35:24] Silex: Quit: WeeChat 0.4.3
[14:35:50] Silex: has joined #RubyOnRails
[14:35:50] Silex: has joined #ruby

2015-10-27

[09:29:20] Silex: with rails i18n, is there a tool to edit the files easily for translators? maybe something that converts to PO?
[09:29:28] Silex: (poedit is crossplatform)
[09:30:31] Silex: Radar: thanks, I also just found https://github.com/pejuko/i18n-translators-tools
[09:31:11] Silex: ah, it's only free up to a limit
[09:32:53] Silex: https://github.com/unho/yaml2po
[09:35:43] Silex: rvanlieshout: yeah, I just found https://github.com/grosser/gettext_i18n_rails which seems to come with https://github.com/grosser/translation_db_engine which is like localapp.com

2015-10-22

[15:06:55] Silex: *.net *.split
[15:44:47] Silex: has joined #ruby
[15:44:49] Silex: has joined #RubyOnRails

2015-10-16

[00:08:47] Silex: has joined #RubyOnRails
[00:08:54] Silex: has joined #ruby

2015-10-08

[00:24:20] Silex: Ping timeout: 240 seconds
[00:32:38] Silex: has joined #ruby
[00:32:40] Silex: has joined #RubyOnRails

2015-10-06

[09:55:51] Silex: Quit: WeeChat 0.4.3
[09:56:18] Silex: has joined #RubyOnRails
[09:56:18] Silex: has joined #ruby

2015-10-01

[12:56:09] Silex: I'm making an app that requires dynamic ACLs (stored in the db). I have no problem saying stuffs like "this user has access to this resource", but I have trouble making _editable_ roles with rules like "users with this role are able to view records where :foo == bar"
[12:56:35] Silex: What is the simplest way to edit/store conditions?
[12:57:13] Silex: e.g even storing the simple "Users of role 'user' are allowed to edit their own entry" is complicated
[12:58:37] Silex: Blaze_Boy: so, not really fully editable permissions but offer a set of the most common requirements?
[12:59:52] Silex: e.g: Permission.create(controller: :user, action: :edit_self) ?
[13:00:54] Silex: I was originally thinking of Permission.create(controller: :user, action: :edit, conditions: { id: current_user.id })
[13:01:10] Silex: and eval the conditions when checking permissions, but that sounds a bit nasty
[13:01:48] Silex: Blaze_Boy: yes but that logic would be static
[13:01:59] Silex: e.g not editable through the admin interface
[13:02:44] Silex: maybe I'd just give up on such granularity
[13:03:09] Silex: and have immutable rules like "you can edit what you created"
[13:04:18] Silex: anyway, thanks

2015-09-25

[12:25:05] Silex: I originally started with cancan but it became unmaintenable. I was in the transition to migrate to pundit when I noticed acl9
[12:25:45] Silex: all the other authorization plugins seems kinda inactive (authority, declarative_authorization)
[12:28:18] Silex: baaasically my question is: acl9 *looks* well thought out and the authorization centralization is rather nice, while pundit policies are equally nice but the credentials verification is more spread out everywhere: How come acl9 is not more known?
[12:30:15] Silex: defsdoor: you probably never needed much granularity
[12:31:44] Silex: defsdoor: it's pretty massive to implement
[12:32:31] Silex: defsdoor: right... gem users are idiots :)
[12:34:17] Silex: defsdoor: understand I'm talking dynamic ACLs, not just reinventing "rolify" with a bunch of basic route checks
[12:36:44] Silex: damnit, I just found out about "consul"
[12:38:01] Silex: ACTION is lost

2015-09-22

[22:14:53] Silex: Ping timeout: 252 seconds

2015-09-16

[11:59:23] Silex: mices: "banned for asking for help" that sounds very unlikely
[12:00:25] Silex: ok I just read the backlog, apparently "asking for help" means annoying people with passenger/puma questions and continuing when told to stop
[12:01:28] Silex: jhass: yeah, and after being helped for like 30 minutes

2015-07-22

[09:19:16] Silex: meatchicken: is there a language where a struct is faster than a class?
[09:19:31] Silex: Ox0dea: not true
[09:19:44] Silex: meatchicken: ah, yeah maybe
[09:20:24] Silex: Ox0dea: well for starter there's no class in C, assuming you meant C++ struct is stricly equivalent to class
[09:20:59] Silex: Ox0dea: sure but it's not really a class is it?
[09:21:16] Silex: well it's just a struct function pointers
[09:21:19] Silex: struct with*
[12:34:13] Silex: /etc has so many configs it needs to be set up 3 tiems
[15:43:51] Silex: Ping timeout: 246 seconds
[15:51:10] Silex: has joined #RubyOnRails
[15:51:16] Silex: has joined #ruby

2015-07-20

[12:04:31] Silex: shevy: surely you mean one yaml per configurable "logical set of options"?
[12:05:17] Silex: if the configuration files each contain one line I'd cry too yes
[12:05:46] Silex: it's not even yaml as this point
[12:05:48] Silex: the file name is the key
[12:05:53] Silex: and the content is the value

2015-07-17

[10:47:56] Silex: the second 'o' of food different
[10:48:23] Silex: s/food/of the first 'food' is/
[10:49:28] Silex: funny it displays weirdly for the 2nd o here
[10:50:01] Silex: or maybe not and my brain tricks me
[10:50:59] Silex: the ; one is a different char
[10:51:11] Silex: and thus it's like a 1-char variable name
[10:53:33] Silex: I'm sure the LTR zero-width char trick can be used to drive dev crazy
[10:53:39] Silex: e.g fill an online form with this char
[10:53:44] Silex: then complain that you can't log in
[14:34:52] Silex: logical not - bitwise not ?
[14:35:35] Silex: e.g !~x is x = ~x; x = !x;
[14:35:46] Silex: forget the assignments
[14:36:00] Silex: bitwise not
[14:37:32] Silex: ah, yes apparently it is
[14:37:53] Silex: I guess it means "doesn't match"
[14:40:46] Silex: funny, it seems "A ! ~ B" can have several meaning wether A is a function or a String
[14:41:17] Silex: ljarvis: the space matters?
[14:42:17] Silex: ljarvis: you're right, the space matters
[14:42:27] Silex: A ! ~ B works with def A(x); end
[14:42:35] Silex: and B = 3
[14:46:20] Silex: JimmytheHat: gcc is typically compiled with gcc too :)
[14:48:43] Silex: flaf: shouldn't we avoid @@ class variables when possible?
[14:49:54] Silex: I mean, instead of using @@ class variable we'd use cattr_accessor etc
[14:50:27] Silex: err, not cattr_accessor... but something! :)
[14:50:57] Silex: flaf: see what ljarvis said, use class instance variables instead
[15:09:53] Silex: flaf: a method would then use Foo.thing = 123 or self.class.thing = 123
[15:12:35] Silex: [k-: for example to count the number of instances you have
[15:14:25] Silex: I wish @@var notation never existed
[15:15:34] Silex: havenwood: that's exactly why I wish they never existed
[15:17:10] Silex: oh right there's these eigenclasses thing I forgot about those

2015-07-16

[12:42:43] Silex: except "to_s" instead of "name" I don't see much you can improve :)
[12:44:51] Silex: livcd_: it makes it a little bit clearer the class is really dumb
[12:51:38] Silex: DefV: one down, only 4 more "why" to go :)

2015-07-13

[15:36:52] Silex: *.net *.split
[15:37:27] Silex: has joined #RubyOnRails
[15:37:33] Silex: has joined #ruby

2015-07-02

[13:15:03] Silex: wasamasa: iirc, you need to reload!
[13:17:01] Silex: wasamasa: http://stackoverflow.com/questions/1890709/combining-many-rake-tasks-into-one-rake-task
[13:17:26] Silex: wasamasa: if I recall correctly, the problem is simply that your env is not reloaded after the migration
[13:17:46] Silex: wasamasa: try with the syntax from the linked page
[13:17:53] Silex: which uses the shell or smth
[13:18:08] Silex: Rake::Task["db:drop"].invoke
[13:18:41] Silex: ah meh, the second answer does it like you do
[13:18:53] Silex: so I'm confused now, try to figure out what fails in the seed
[13:21:15] Silex: wasamasa: Rake::Task['db:seed'].reenable (see https://gist.github.com/wulftone/1332577)
[13:23:07] Silex: wasamasa: hum, inspect your models from the seed file
[13:23:14] Silex: e.g Model.connection or Model.reload or whatever
[13:24:08] Silex: wasamasa: maybe the db transaction isn't over yet? :)
[13:29:47] Silex: wasamasa: I'm just exploring ideas
[13:29:54] Silex: wasamasa: I'm good at finding possible causes :)
[13:30:39] Silex: wasamasa: "reload!" is what you type in "rails console" to reload everything

2015-06-26

[08:42:30] Silex: apeiros: oh, you have configs that are "production ready" in your repo
[08:42:33] Silex: that sounds dangerous
[08:42:42] Silex: apeiros: as I showed you, it takes 0ms by me
[08:42:50] Silex: so probably something with your config/version/whatever