Activity Graph

Page 1 of 6 | Next »


[00:13:19] silverdust: Ping timeout: 260 seconds


[23:39:42] silverdust: has joined #RubyOnRails
[23:40:24] silverdust: has left #RubyOnRails: ()
[23:41:00] silverdust: has joined #RubyOnRails


[14:33:28] silverdust: Ping timeout: 256 seconds


[12:25:53] silverdust: *.net *.split
[12:27:35] silverdust: has joined #RubyOnRails
[15:01:23] silverdust: *.net *.split
[15:03:03] silverdust: has joined #RubyOnRails


[20:45:16] silverdust: *.net *.split


[02:28:45] silverdust: has joined #ruby


[08:49:09] silverdust: has joined #ruby
[08:49:09] silverdust: Changing host


[16:19:54] silverdust: *.net *.split
[18:45:04] silverdust: has joined #ruby


[15:07:51] silverdust: What are some classes/libs to look out for when sandboxing ruby for public use
[15:28:43] silverdust: Thanks for the inputs dminuoso Papierkorb
[15:29:10] silverdust: Was already told that put it in a docker container would be the best thing to do
[15:29:55] silverdust: But I was lazy about the implementation cost. Wish to have seen something like this for ruby
[15:31:42] silverdust: dminuoso: is this the geordi you were talking about ?
[15:32:45] silverdust: I'm currently blocking exec , sys, backtics , and %x
[15:32:57] silverdust: Then Dir and File
[15:34:10] silverdust: I blocked require too
[15:34:51] silverdust: I'm following all of these things. You aren't wasting your time
[15:39:21] silverdust: yes my goal is for nothing to be able to be required. You could still do things like Math::cos(0)
[15:42:51] silverdust: Thanks to y'all for your inputs
[15:43:55] silverdust: Thought from the start that blacklisting is never a good security option but didn't know ways to whitelist or even things to whitelist. I guess I can figure something from here
[15:44:03] silverdust: no p Salmonidae


[01:03:48] silverdust: has joined #ruby
[01:04:10] silverdust: Is there a way to run ruby inline like `ruby -i "puts 'hello'"` ?
[01:04:24] silverdust: Great! Thanks
[01:18:07] silverdust: Oh I'm aware of all that havenwood . Thanks
[01:18:31] silverdust: I just needed the inline version
[03:19:05] silverdust: Is there a place to see libraries I can require without installing a gem
[03:19:27] silverdust: Like libraries that ship with ruby


[00:14:13] silverdust: Write error: Broken pipe
[00:14:15] silverdust: has joined #ruby
[13:23:01] silverdust: has joined #ruby
[13:23:01] silverdust: Changing host


[19:33:17] silverdust: has joined #ruby
[19:33:17] silverdust: Changing host


[10:42:42] silverdust: has joined #ruby


[09:01:07] silverdust: *.net *.split


[10:47:05] silverdust: What's the best way to inject on a property of a hash like {a: 50, b: 20, c: 30}
[10:49:55] silverdust: Is it best to convert to 2D array and use inject like myHash.to_a.inject{ |a, b| a[1] + b[1] }
[10:50:06] silverdust: ljarvis: I'm trying to add up all the values in the hash
[10:52:18] silverdust: oh .values is what I needed
[10:52:42] silverdust: I also do. Just thought more people here prefer inject so I try to adapt. Thanks


[07:49:21] silverdust: has joined #ruby
[07:49:21] silverdust: Changing host
[16:22:07] silverdust: *.net *.split
[16:28:05] silverdust: has joined #ruby


[13:02:53] silverdust: *.net *.split
[13:14:31] silverdust: has joined #ruby
[13:26:31] silverdust: *.net *.split
[21:21:38] silverdust: has joined #ruby


[03:12:06] silverdust: *.net *.split
[10:06:53] silverdust: has joined #ruby
[12:10:56] silverdust: has joined #ruby
[12:10:56] silverdust: Changing host


[01:46:37] silverdust: has joined #ruby
[01:46:37] silverdust: Changing host


[16:41:13] silverdust: *.net *.split
[18:32:14] silverdust: has joined #ruby


[16:32:07] silverdust: Ping timeout: 252 seconds
[16:32:10] silverdust: has joined #ruby
[21:25:10] silverdust: has joined #ruby
[21:25:10] silverdust: Changing host


[13:35:36] silverdust: has joined #ruby
[13:35:36] silverdust: has joined #RubyOnRails
[13:35:36] silverdust: Changing host


[20:55:33] silverdust: has joined #RubyOnRails
[20:55:33] silverdust: has joined #ruby
[20:55:33] silverdust: Ping timeout: 252 seconds


[16:06:04] silverdust: has joined #ruby
[16:06:04] silverdust: has joined #RubyOnRails
[16:06:04] silverdust: Changing host


[05:30:33] silverdust: Ping timeout: 252 seconds
[05:53:51] silverdust: has joined #RubyOnRails
[05:53:51] silverdust: has joined #ruby


[21:39:55] silverdust: What's the name of this inner gem that devise uses for auth providers?
[21:40:08] silverdust: Begins with a W
[21:40:35] silverdust: I didn't see it in there
[21:40:47] silverdust: I did. Thought I'd see it in the Gemfile
[21:41:22] silverdust: Saw it in the documentation


[05:34:29] silverdust: I have date in this format 2016-07-11T14:25:58.000Z and I want to convert to Time. With'2016-07-11T14:25:58.000Z') I don't get the same date
[05:37:47] silverdust: yes. Thanks shevy


[15:00:26] silverdust: has joined #ruby
[15:01:03] silverdust: How may I add a authorization header to Net::HTTP.get ?
[15:22:19] silverdust: Where can I fit in a request header in this Net::HTTP.get(URI.parse(some_uri)) ?
[16:02:49] silverdust: Thanks kaleido , imperator . That gives me a 400 bad request. I'll look into rest-client
[16:03:08] silverdust: With curl and postman I get a proper response


[15:17:03] silverdust: Just how many reserved words will I encounter. I create a transaction:references and now I can't have a belongs_to :transaction
[15:17:41] silverdust: Do I have to rename my transactions table now to something else I can reference
[15:21:04] silverdust: fox_mulder_cp: yes but when I run rspec I get this: You tried to define an association named transaction on the model Purchase, but this will conflict with a method transaction already defined by Active Record. Please choose a different association name.
[15:22:02] silverdust: Just like how type is reserved for STI I guess
[15:22:32] silverdust: Maybe transaction reference is reserved for some other thing Idk about
[15:23:26] silverdust: I take out belongs_to :transaction and it works but then I can't have Transaction.nested_model_data


[09:24:56] silverdust: I have a `before_action :authenticate_admin!` with devise and I have a PUT action that serves as an API. How may I get the API users to authenticate? If I had to give a header key for authorization how should I go about that?
[09:27:27] silverdust: right now API users will just get a 302 response as it tries to redirect them to the login page for authentication
[09:30:43] silverdust: dminuoso: I'll like to provide a key for Header authorization
[09:34:34] silverdust: I've never used Warden but I'll look into this to see how I can apply it
[09:36:41] silverdust: ha I see so I don't have to install a separate gem for it since it's a devise dependency
[09:43:08] silverdust: This makes more sense. Warden is just like PassportJS
[09:53:40] silverdust: dminuoso: wouldn't it just be easier if I added an exception for the action of my api from authenticate! and check the headers to see if a token is set manually?
[09:54:07] silverdust: It looks a little intimidating and I can't find a hand-holding guide
[09:54:17] silverdust: Hi sevenseacat
[09:54:57] silverdust: Hope you're having a good day
[10:39:41] silverdust: dminuoso: Can I just skip authentication and focus on authorization by headers?
[10:39:58] silverdust: Even using Warden directly
[10:40:48] silverdust: My goal is give out API to accept PUT/PATCH operation and provide a single header authorization key
[10:41:56] silverdust: I'd skip authentication for that API completely if it wasn't something that when used maliciously can cause a great harm
[11:38:14] silverdust: dminuoso: you there?
[11:59:49] silverdust: it could also be pry with pry-rails gem
[12:21:49] silverdust: dminuoso: as in `before_action authenticate_user!, except: [:myAPImethod]`
[12:25:05] silverdust: great. So what I just did is real simple. Here
[12:26:17] silverdust: dminuoso: not bad I guess. It's actually `if request.headers['API-KEY'] == 'whatever'`
[12:27:01] silverdust: And I'm hard-coding the API-KEY
[12:27:22] silverdust: All the method just does is something like Foo.update(attrs)
[12:29:41] silverdust: okay I'll do that
[12:31:53] silverdust: rvanlieshout: So this
[12:34:10] silverdust: okay that's neater. I don't think ruby enough to have done that. So that's just short for `return false unless condition`
[12:35:21] silverdust: okay thanks dminuoso , rvanlieshout
[13:04:14] silverdust: I find this weird `Product.find_by('stock_id', params[:stock_id])`
[13:04:28] silverdust: PG::DatatypeMismatch: ERROR: argument of WHERE must be type boolean, not type integer LINE 1:
[13:05:05] silverdust: Then I tried Product.where() it was fine then Product.where().take gave the error again
[13:06:25] silverdust: when I .to_sql I have `SELECT "products".* FROM "products" WHERE (stock_id) LIMIT 1)`
[13:06:37] silverdust: which means it's not passing my value to the SQL query
[13:08:11] silverdust: ah dammit. My bad. Thanks dkam


[00:28:05] silverdust: has joined #RubyOnRails
[00:28:05] silverdust: Changing host


[08:43:08] silverdust: Ping timeout: 252 seconds


[09:58:13] silverdust: How does rails reserve logged in session after server restart?
[09:59:31] silverdust: Using express now which is very basic and seeing how it uses MemoryStore by default which loses sessions on server restart it got me wondering how rails does it. I'm resorting to using redis with express now
[10:00:10] silverdust: expressjs I meant
[10:01:00] silverdust: Perhaps it stores the session data in the database
[10:02:32] silverdust: okay I see. Thanks


[15:59:19] silverdust: How can I change action dispatch's X-Frame-Options header and what are the options?
[15:59:51] silverdust: I want a mobile app loading it in an iframe within webview
[16:00:11] silverdust: defualt is SAMEORIGIN but I can't find any other option I can set to it
[16:10:54] silverdust: It's a wrong thing to do but I'm being told to do it. Now I'm told to take out X-FrameoOptions entirely exposing the web app to csrf vulnerabilityies
[16:11:17] silverdust: I'd just ignore the request I guess
[16:13:48] silverdust: for the mobile
[16:16:33] silverdust: workmad3: It doesn't say where frame-ancestors should be set. It just says it's not supported in the meta
[16:20:25] silverdust: It's in fact an experimental feature and not recommended for production
[16:34:29] silverdust: Thanks workmade. Do I do this with actionDispatch or the response object in the controller?
[16:38:01] silverdust: I guess action_dispatch


[11:51:45] silverdust: How do I stop a form submission from ajax:before of ujs
[11:52:03] silverdust: I check for a certain condition but I don't know how to abort
[12:02:52] silverdust: figured I had to return false
[12:13:14] silverdust: are you certain that 2.2.* is installed?
[12:14:40] silverdust: You can run rbenv local but I think it's best to have the third build number
[12:16:02] silverdust: Then just add the patch version


[13:21:26] silverdust: If I had 2 or more routes that leads to a controller method is there a way to group them e.g get ['/foo','/bar'] => 'myController#method'
[13:33:17] silverdust: rvanlieshout: how may I apply constraints? '/:anything' scares me because of how it overrides some other routes
[18:46:05] silverdust: Can I run a migration to change a table name. I'm working with a poorly built rails app and it has a lot of users on production but poorly named model names
[18:46:49] silverdust: It shouldn't matter but my role is to create APIs on it and I can't do that with the poor routes that exist now
[18:47:19] silverdust: Changing the routes leads to changing the controllers which leads to changing models
[18:48:22] silverdust: To just change the database table name
[18:49:33] silverdust: You mean leaving the existing routes and creating new routes that point to the actions I want
[18:52:57] silverdust: durexlw: it does when it's resource routes


[05:12:56] silverdust: Ping timeout: 246 seconds
[14:47:56] silverdust: has joined #RubyOnRails
[14:47:56] silverdust: Changing host


[12:32:54] silverdust: has joined #RubyOnRails


[11:06:11] silverdust: Quit: leaving


[01:13:38] silverdust: has joined #RubyOnRails
[01:13:38] silverdust: has joined #ruby
[01:13:38] silverdust: Changing host


[08:12:11] silverdust: *.net *.split


[14:00:46] silverdust: I added unique:true to a table and it's not what I expected. I'll like it to only be unique to a user_id
[14:01:35] silverdust: i.e userA can't have slug 'stuff' twice but another user can have slug 'stuff'
[14:01:49] silverdust: but with what I have other users can't have slug 'stuff'
[14:02:31] silverdust: How can I fix this to behave as expected?
[14:03:31] silverdust: tbuehlmann: yes
[14:06:13] silverdust: I have this: add_index :favgroups, :slug, unique: true
[14:08:26] silverdust: so I should create a migration to remove unique on the table index then what ropeney said?
[14:08:49] silverdust: By unique index you mean what I already have right?
[14:09:38] silverdust: I just said this -> add_index :favgroups, :slug, unique: true
[14:09:48] silverdust: I didn't think it was much enough for a paste
[14:11:47] silverdust: I don't think I get your point
[14:13:08] silverdust: add_index(:favgroups, :slug, unique: true)
[14:13:51] silverdust: That's what it'll be with my own fields and the only difference here is the parentheses
[14:28:45] silverdust: what's the rails validation like?
[14:30:18] silverdust: validates :slug, uniqueness { scope: :user_id } right ropeney ?


[01:10:33] silverdust: In the request object I see #query_string and #query_hash methods but when I try request.query_hash I get undefined method. Why is that?
[01:12:47] silverdust: oh how else can I get a hash of query parameters without using params. I need this to analyze an API


[16:13:43] silverdust: yea arup_r the last time I had an issue of paperclip delaying first byte time for my cdn uploads new relic led me straight to the problem
[16:14:07] silverdust: I realized paperclip doesn't play fine with Rackspace
[16:15:02] silverdust: I'm on that team now
[16:15:10] silverdust: arup_r: there's a free plan
[16:15:33] silverdust: I didn't pay up to $0.0001 on mine


[08:57:30] silverdust: My jasmine spec can't find my constructors but it can find regular functions
[08:57:51] silverdust: Anyone else using jasmine for js testing in their rails app?
[13:06:04] silverdust: Is there an inflector method to singluarlize or pluralize names based on the number it receives
[13:07:59] silverdust: like (1,'puppy').stuff #=> '1 puppy', (2, 'puppy').stuff #=> '2 puppies'
[13:25:19] silverdust: Thanks epochwolf


[11:46:47] silverdust: What does !~ mean? I saw this foo !~ some_regex
[11:48:44] silverdust: has joined #ruby
[11:49:12] silverdust: What does !~ mean? I saw this: foo !~ some_regex
[11:49:43] silverdust: i.e must not match
[12:01:49] silverdust: arup_r: I got help from #ruby
[12:02:04] silverdust: It's regex negation opposite of =~


[00:54:14] silverdust: a1fa: fixed? Sorry I had to leave


[14:46:05] silverdust: has joined #RubyOnRails
[22:56:18] silverdust: you mean like aria-hidden="true" ?


[17:57:19] silverdust: Ping timeout: 260 seconds
[17:57:54] silverdust: has joined #RubyOnRails
[17:57:54] silverdust: has joined #ruby


[08:42:41] silverdust: has joined #ruby
[18:09:52] silverdust: has joined #RubyOnRails


[11:37:19] silverdust: has joined #RubyOnRails
[11:38:56] silverdust: When I fetch url of a image that doesn't exists from console like this Advert.find(3).upload.image.url I get the missing url returned but on the web page it throws an error that undefined method image for nilClass
[11:39:42] silverdust: I don't want to have to check with conditions all the time. I'll like if it just loads the default image without throwing error
[23:25:48] silverdust: Quit: leaving


[13:50:21] silverdust: I have this on a single line t.each_with_index { |h, i| if h.a == 'cool' puts i; end } what's wrong with the statement?
[13:50:39] silverdust: >>t.each_with_index { |h, i| if h.a == 'cool' puts i; end }
[13:52:59] silverdust: >>t = [, :b).new('cool','stuff'),,:b).new('cat','dog'),, :b).new('cool','bad')]; t.detect { |h| h.a == 'cool' }
[13:53:41] silverdust: what I want is to get the index of the returned array item
[13:53:51] silverdust: how can I do that?
[13:58:33] silverdust: yes absolutely
[13:58:56] silverdust: I'm just ignorant and I'd love to be pointed in the right direction
[14:01:44] silverdust: I need to delete a struct within an array so I'm trying to check for the struct by an item it and get its index then delete from the array with acquired index
[14:03:00] silverdust: how can I? I have #<struct id="4" stuff="hey"> and others with different ids. How can I delete the one with id=4?
[14:03:20] silverdust: I mean other structs with different ids within the array
[14:05:34] silverdust: I don't mind. It's what I need. Thanks but just in case how can I make it stop at the first it finds
[14:09:10] silverdust: you mean if I'd like to keep it in the same order after deleting an item?
[14:10:36] silverdust: I'd like to believe that removing 6 from [4,6,9,3] will leave me with [4,9,3]
[14:11:45] silverdust: okay. Set works just like in python I guess. arranges them from smallest to largest value
[14:46:28] silverdust: How can I log the value of a variable in my server console while debugging in controller or model?
[19:38:39] silverdust: Ping timeout: 260 seconds