tbuehlmann

Activity Graph

Page 1 of 45 | Next »

2019-05-17

[07:57:23] tbuehlmann: old_relik: what's a bot user?
[08:00:09] tbuehlmann: you could create it using seeds when setting up the database
[10:31:12] tbuehlmann: xco: what have you tried?
[10:37:30] tbuehlmann: and what exactly didn't work with that approach?
[10:42:11] tbuehlmann: no, I mean what didn't work with the "MORE RECENTLY" approach?
[10:46:07] tbuehlmann: `next unless value = public_send(meth)` <-- do you know what this part does?
[10:52:26] tbuehlmann: it invokes the methods, correct. so is this a good place to check for presence?
[10:54:51] tbuehlmann: that would assign `true` or `false` to value, that's probably not what you want, right?
[10:56:27] tbuehlmann: yup, that'll do
[10:57:31] tbuehlmann: btw, this looks like an SQL injection is possible, doesn't it?
[12:58:06] tbuehlmann: Remote host closed the connection

2019-05-16

[08:50:08] tbuehlmann: Remote host closed the connection
[08:59:16] tbuehlmann: has joined #ruby
[08:59:17] tbuehlmann: has joined #RubyOnRails
[10:38:01] tbuehlmann: protip: DISABLE_SPRING=1 in your ~/.bashrc or whatever you're using
[11:37:47] tbuehlmann: VSpike: the second one should be the ABI

2019-05-15

[11:38:10] tbuehlmann: Silex: that's not correct, you can and should still use regular arguments
[11:52:19] tbuehlmann: indeed that's weird and I wouldn't have expected this

2019-05-13

[11:02:42] tbuehlmann: garyserj: this is rails-ujs' doing
[11:08:33] tbuehlmann: it doesn't convert it, it'll probaby intercept the click and do its thing
[11:08:43] tbuehlmann: somewhere in here: https://github.com/rails/rails/blob/v5.2.3/actionview/app/assets/javascripts/rails-ujs/features/remote.coffee

2019-05-08

[10:50:04] tbuehlmann: there's also https://github.com/nfedyashev/retryable if you don't want to implement it yourself
[11:51:53] tbuehlmann: ss942: you can use view helpers in helper methods, just call the methods directly
[11:52:44] tbuehlmann: if things get too complicated you can use a partial instead
[13:32:49] tbuehlmann: you're welcome!

2019-05-07

[08:38:07] tbuehlmann: homebear: seems rails can't find the template. what directories/files do you have in app/views?
[09:41:21] tbuehlmann: andywww: not sure about that, but there are optional groups. gems in this group would only be installed when running `bundle install --with name`, maybe that's something for you. this group would be in the same Gemfile, though
[09:42:13] tbuehlmann: see https://bundler.io/guides/groups.html#optional-groups
[09:56:33] tbuehlmann: the guide talks about installing, that's surprising

2019-05-02

[09:50:26] tbuehlmann: hahuang65: you're looking for hooks and filters: https://relishapp.com/rspec/rspec-core/v/3-8/docs/hooks/filters
[09:51:27] tbuehlmann: Raven737: what is this "domain" variable?
[09:53:03] tbuehlmann: okay. can you search your project for "force_ssl"?
[09:56:33] tbuehlmann: https://github.com/iobridge/thingspeak/blob/9d4b74d3daea413f37f3b92f09a5c14621a6fc9b/app/controllers/application_controller.rb#L186-L196
[09:57:04] tbuehlmann: looks like it converts the protocol to https in the production environment
[09:57:53] tbuehlmann: no problem, you're welcome!
[13:49:05] tbuehlmann: raz: there's no release date, but as we're on 6.0.0.rc1, it won't take long

2019-04-17

[10:40:11] tbuehlmann: it's basically the same, just using the local variable `user` instead of the instance variable `@user`
[10:45:49] tbuehlmann: yeah, when rendering the form the variable is passed
[11:00:47] tbuehlmann: garyserj: some browsers don't support certain http verbs, so rails uses POST instead of PUT and adds a custom form field to denote the actual http verb
[11:01:44] tbuehlmann: something like this: <input type="hidden" name="_method" value="put">

2019-04-16

[09:33:27] tbuehlmann: deians: what's the problem?

2019-04-13

[16:49:51] tbuehlmann: *.net *.split

2019-04-12

[11:41:49] tbuehlmann: jarr0dsz: active record will deserialize it when you fetch it. when creating the csv, you could use the same serialization mechanism
[11:42:57] tbuehlmann: how is that column serialized? json? yaml? something else?
[11:46:11] tbuehlmann: `serialize` probably serializes to yaml, so you could manually serialize the object to yaml
[11:50:06] tbuehlmann: try YAML.dump(request.serialized_column)
[11:51:08] tbuehlmann: is the receiving side also serializing that column? because it basically doesn't matter to what format you serialize in the csv as you have to deserialize on the receiving end either way
[11:57:19] tbuehlmann: it depends on how you plan to import the data
[12:00:16] tbuehlmann: YAML.load(that_attribute)
[12:00:36] tbuehlmann: so it basically doesn't matter how you serialize it, could be JSON as well
[12:06:12] tbuehlmann: you wouldn't work with the object's yaml representation directly, you would work with the object. what exactly is it? an array? of strings?
[12:10:30] tbuehlmann: no, yaml would correctly store them as integers. if they are strings, they were likely strings from the very beginning
[12:12:37] tbuehlmann: YAML.load(YAML.dump([42])) # => [42]
[12:13:04] tbuehlmann: yes, the quotes mean they are strings when deserialized
[12:16:12] tbuehlmann: if the question is how to convert an array of strings to an array of integers, one simple one would be ['42'].map(&:to_i)
[12:16:30] tbuehlmann: there are other options, though. Integer('42') for example
[12:45:53] tbuehlmann: jarr0dsz: for what? displaying purposes?

2019-03-29

2019-03-27

[10:02:25] tbuehlmann: dionysus69: there's String#to_sym, but String#to_sym! doesn't make sense
[10:06:33] tbuehlmann: what's your usecase? why is it that you don't know var's type? there's Symbol#to_sym as well, which should be a no-op, so `var = var.to_sym` would work. also, why do you need it as a symbol?

2019-03-26

[08:53:20] tbuehlmann: dionysus69: https://github.com/ruby/ruby/blob/v2_6_2/ext/psych/lib/psych/core_ext.rb#L12-L14

2019-03-25

[14:27:22] tbuehlmann: modules are classes, but this is not what you're after I guess. why wouldn't you be able to test a module?
[14:44:14] tbuehlmann: what's the problem? what error do you get?

2019-03-19

[13:06:00] tbuehlmann: are you running `$ bundle update rails`?
[13:15:27] tbuehlmann: Animazing: yeah, make sure it all works out
[13:46:12] tbuehlmann: if RouteuPoint belongs to a city, then yes, that's how it should be modeled

2019-03-18

[09:59:21] tbuehlmann: Spaceman77: yes, see https://guides.rubyonrails.org/active_record_validations.html#conditional-validation
[14:14:24] tbuehlmann: what's your definition of "repeating"?

2019-03-13

[07:03:27] tbuehlmann: Cork: have an example of what you mean?
[07:14:53] tbuehlmann: I'd say the before_create should be a before_validation
[07:28:10] tbuehlmann: before_validation should be in the transaction already
[07:28:35] tbuehlmann: another approach: can't you make sure the record exists before creating the private network?
[07:37:20] tbuehlmann: heh, you're welcome!
[08:30:34] tbuehlmann: what does "database management" mean exactly?
[08:33:12] tbuehlmann: why wouldn't you do that in the rails app?
[08:42:01] tbuehlmann: web and api sounds like a rails app to me. a cli could be a gem (or script), but using the api, not interacting with the database on its own
[14:47:24] tbuehlmann: no, that's a pretty big topic

2019-03-11

[09:22:00] tbuehlmann: solely relying on rails validations can lead to errors
[09:26:11] tbuehlmann: is this original code? do you just assign a random number?
[09:27:52] tbuehlmann: yeah, then go and rescue that exception. if you don't do it, errors could be raised
[09:28:11] tbuehlmann: do you really a need a random number, though? what purpose does it have?
[09:30:57] tbuehlmann: okay, I don't have anything to add, then
[10:03:38] tbuehlmann: sure, either that or `path ||= Pathname.new(default_path)`. default_path could be a Pathname already, but that's up to you. you could also assign the default path before going into the conditions

2019-03-07

[08:57:29] tbuehlmann: it's a micro optimization not worth talking about. so, "no", they do not perform better
[09:24:27] tbuehlmann: I can see that tweet, mister

2019-03-06

[10:09:31] tbuehlmann: rizwan_: you probably don't have bundler installed. try running `gem install bundler`
[10:12:46] tbuehlmann: npm has nothing to do with ruby, don't do that
[10:13:18] tbuehlmann: what exactly happens when you run `gem install bundler`?
[10:17:31] tbuehlmann: you're running `ruby console`, you probably mean `rails console`
[10:20:15] tbuehlmann: even after installing bundler?
[12:14:55] tbuehlmann: you're using an _url helper, so I assume this is a system test?
[12:16:30] tbuehlmann: either way, there's probably no route for that. you want edit_task_url(@task)
[12:17:10] tbuehlmann: should be edit_task_path then
[12:20:25] tbuehlmann: right, as said, there's no such route. try edit_task_path(@task)
[12:21:32] tbuehlmann: edit_task_path(@task) will return that string
[12:22:13] tbuehlmann: you're welcome!

2019-03-05

[00:10:36] tbuehlmann: Ping timeout: 252 seconds
[00:12:25] tbuehlmann: has joined #ruby
[00:12:25] tbuehlmann: has joined #RubyOnRails
[14:24:05] tbuehlmann: I also recommend the official guides. there's also a part for api-only applications: https://guides.rubyonrails.org/api_app.html

2019-03-04

[13:41:47] tbuehlmann: adding `driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]` doesn't work for you?
[13:51:42] tbuehlmann: remove all the Capybara.register_driver stuff and the Capybara.server_port and try again
[13:52:34] tbuehlmann: also, do you have the `js: true` metadata in the example that you're testing?
[13:53:03] tbuehlmann: https://github.com/tbuehlmann/til/blob/master/rails/headless-system-tests.md - this is all I got and that works for me
[14:01:01] tbuehlmann: syndikate: sure
[14:01:18] tbuehlmann: pavelz: add an `as: 'hello'` option to your route
[14:01:34] tbuehlmann: I'd also reconsider this, maybe `resources` is what you want
[14:43:02] tbuehlmann: I think that'll change the type to :feature, maybe overriding it
[15:57:33] tbuehlmann: .where(published: true) could be a default which is overridable by the user
[16:00:42] tbuehlmann: it's often easier to first apply the defaults and only later apply the user's needs

2019-03-02

[09:17:30] tbuehlmann: c-c: you can call `yield your_instance` which will run the block with that variable as block variable
[09:19:14] tbuehlmann: https://gist.github.com/tbuehlmann/dd07be2f539cc8c7fc927df2eef2b04a
[11:44:33] tbuehlmann: I'd just make this migration irreversible ¯\_(ツ)_/¯
[12:13:24] tbuehlmann: yarn is still in. you probably mean that webpacker is used for javascript instead of sprockets
[12:58:21] tbuehlmann: dionysus70: have you even checked google?

2019-02-28

[11:27:26] tbuehlmann: I don't think there's a method for that
[12:04:11] tbuehlmann: husam212: I don't think so. as helpers are modules, you could include these modules into your object and just call the methods
[12:59:59] tbuehlmann: Psy-Q: right, you'd route that to a custom controller action that would respond whatever you like
[13:08:57] tbuehlmann: right, it renders the public/404.html. for json requests, it'll render {"status":404,"error":"Not Found"}

2019-02-27

[13:26:09] tbuehlmann: arkentias, YourModel.find(id) will find by id. you can then call association methods on that object to retrieve that association
[13:27:50] tbuehlmann: do you mean finding both records with a single sql query?
[13:31:59] tbuehlmann: sure, sounds easy. what's the problem exactly?
[13:33:20] tbuehlmann: how do you render the json right now?
[13:43:27] tbuehlmann: arkentias, try this: `render json: @transaction.as_json(include: [:procedure])`
[13:49:52] tbuehlmann: you're welcome

2019-02-26

[08:41:45] tbuehlmann: pavelz: try `render 'admin/user/list', locals: {locked: true}`
[13:55:43] tbuehlmann: are the array elements supposed to be json?
[13:58:58] tbuehlmann: have you tried this? array.map { |element| JSON.parse(element) }
[14:04:32] tbuehlmann: great. why isn't the whole thing json in the first place?
[15:59:09] tbuehlmann: guessing is not enough, you should find out what really slows it down first

2019-02-20

[10:40:31] tbuehlmann: right, we rather handle objects as "truthy" and "falsy" most of the time
[10:55:38] tbuehlmann: yeah, I'd check for == true or == false directly then

2019-02-19

[10:51:57] tbuehlmann: require the file
[10:53:43] tbuehlmann: it's even in the readme, read it
[12:39:37] tbuehlmann: nope, I don't think so
[14:16:38] tbuehlmann: I assume you're talking about rails. if so: #deep_symbolize_keys
[14:28:26] tbuehlmann: if order matters, I personally wouldn't use a hash for that. what about using an array?

2019-02-18

[08:01:30] tbuehlmann: Cork: sure, just let api.user return an object that responds to the methods you need
[08:02:47] tbuehlmann: you could pass whatever you need
[08:39:13] tbuehlmann: how do you make puma log to puma_access.log?
[08:44:41] tbuehlmann: what config does this set?
[08:56:34] tbuehlmann: GeorgesLeYeti: what setting does this set on puma?
[09:08:50] tbuehlmann: sounds like monday
[15:08:24] tbuehlmann: phaul, feature request: make it so I can navigate the hierarchy with arrow keys :D

2019-02-16

[14:54:33] tbuehlmann: you can just leave it as is

2019-02-15

[08:47:11] tbuehlmann: they're gone
[10:36:40] tbuehlmann: there's the rack-cors gem, but shouldn't the domain be the same?
[10:42:18] tbuehlmann: sagax: in rails?
[10:48:20] tbuehlmann: try this: sqlite3 database.sqlite3 .schema > schema.sql
[10:49:24] tbuehlmann: what does this have to do with ruby in the first place?

2019-02-14

[12:05:30] tbuehlmann: andywww: can you add the code you're running to the gist?
[12:05:39] tbuehlmann: including the stacktrace
[12:50:47] tbuehlmann: andywww: you're using `self.user.id` inside that `DocumentType.all.each`
[12:51:05] tbuehlmann: but you don't have user .user method on the DocumentSelectForm class
[12:56:09] tbuehlmann: NoMethodError - undefined method `user' for DocumentSelectForm:Class <-- that errors comes from using self.user.id on the class level
[13:01:08] tbuehlmann: andywww: .attribute is for defining what attributes are generally available in your model
[13:04:29] tbuehlmann: so you want to change the attribute set depending on the user? this won't go well
[13:12:49] tbuehlmann: I'd check if using fields_for and accepts_nested_attributes_for is an option
[13:14:30] tbuehlmann: well, looks like a model to me
[13:14:38] tbuehlmann: just without the database back
[13:14:59] tbuehlmann: this gets too complicated for me, I can't follow
[13:21:10] tbuehlmann: you can name it whatever you like, form object or model
[13:33:41] tbuehlmann: Psy-Q: yeah, just did that in my reproduction script
[13:35:55] tbuehlmann: have you thought about putting the role/mode/type into the contact model?
[13:37:40] tbuehlmann: can the same contact be associated to different accounts?
[13:38:59] tbuehlmann: well, then using what you got should work, right?
[13:42:07] tbuehlmann: yeah, I guess so. you'll probably need to create the Contactable directly
[13:46:35] tbuehlmann: what prevents you from having unique contacts?
[13:48:19] tbuehlmann: for that you got join tables. did I miss the problem?
[13:52:06] tbuehlmann: I'm sure you could hack into the association and set the mode/role/type :)
[13:54:12] tbuehlmann: oh, wait, rails already does it for me
[13:56:32] tbuehlmann: you need to use a hash, not an sql string: has_many :owners, -> { where(contactables: {mode: 'owner'}) }, through: :contactables, source: 'contact'
[13:56:41] tbuehlmann: (my column is named mode, so change that)
[13:57:06] tbuehlmann: if you have that, it seems to behave like a default_scope as it sets the attribute like the where is
[13:58:57] tbuehlmann: some_account.owners.instance_variable_get(:@association).send(:options_for_through_record) # => [{"mode"=>"owner"}]
[13:59:24] tbuehlmann: you're welcome
[14:09:10] tbuehlmann: Psy-Q: right :)
[14:12:54] tbuehlmann: randohinn: looks good. what exactly doesn't work?
[14:17:44] tbuehlmann: rails doesn't understand this as a subdomain. try foo.bar.baz instead of anydomainhere.localhost
[14:19:23] tbuehlmann: you can configure the way rails understands domains, see https://guides.rubyonrails.org/configuring.html#configuring-action-dispatch (config.action_dispatch.tld_length)
[14:20:08] tbuehlmann: setting config.action_dispatch.tld_length to 0 should work for anydomainhere.localhost
[14:22:55] tbuehlmann: config/application.rb or config/environments/*.rb
[14:26:04] tbuehlmann: you're welcome!

2019-02-13

[11:01:07] tbuehlmann: app/* is automatically autoloaded, so you don't need to add any path
[11:01:24] tbuehlmann: app/operations/foo/create.rb would then define a Foo::Create class/module
[11:05:15] tbuehlmann: looks good to me. can you reproduce this behaviour locally?
[11:08:08] tbuehlmann: but so should your staging env?
[11:09:19] tbuehlmann: so you're using docker locally, but the staging env differs from that? how does that makes sense? :)
[11:12:08] tbuehlmann: whatever. hard to tell what's wrong if you can't reproduce it locally

2019-02-12

[13:03:19] tbuehlmann: danger zone?
[13:48:35] tbuehlmann: eminencehc: just use a different method in your controller action. if that doesn't work, something else is wrong
[13:49:40] tbuehlmann: syndikate: shopify's test suite runs for hours, already parallelized. it totally depends on the app's size and on your testing preferences
[14:05:30] tbuehlmann: I don't know how they do it. the testing preference is about what you think is worth to be tested
[14:05:58] tbuehlmann: nah, it's just you're not my highest priority right now
[14:07:23] tbuehlmann: if you test every nuance of your app, things that are not meant to be tested, that'll surely slow down the test suite. also, slow operations will obviously slow down the test suite, like unnecessary database queries
[14:15:37] tbuehlmann: I wouldn't do that. how would you know the tests you're excluding wouldn't fail?
[14:16:41] tbuehlmann: eminencehc: can you paste the controller code?
[14:17:41] tbuehlmann: (as in: use https://gist.github.com/, not actually pasting the code in this channel)
[14:21:15] tbuehlmann: why not use the regular create action?
[14:22:42] tbuehlmann: you could use the same action but different strong params methods
[14:30:34] tbuehlmann: I wouldn't use a different method. if the differences between regular users and ownser are small, have the same controller with different strong params methods and the same views with conditionals
[14:31:29] tbuehlmann: if the differences aren't that small (different redirects?), consider having a different controller and different views. this is a sane option for when you want to have a dedicated admin UI, too
[14:36:47] tbuehlmann: eminencehc: an example: https://gist.github.com/tbuehlmann/b92f7b671754b56a98b65b09ca0fddc9
[14:37:23] tbuehlmann: I can't say whether this makes sense for your use case, but it's certainly an option
[14:56:12] tbuehlmann: can you gist the complete controller code your have right now?
[15:02:35] tbuehlmann: if done properly, both options should work. but if it works now, great
[15:03:41] tbuehlmann: get to go now, happy hacking!

2019-02-11

[09:34:54] tbuehlmann: looks about right
[09:36:46] tbuehlmann: try starting the server with the RAILS_SERVE_STATIC_FILES environment variable set to "1"
[09:38:26] tbuehlmann: yup, you should consider having a reverse proxy in front of the application that directly serves files from the public directory
[09:39:29] tbuehlmann: or configure a CDN that serves the assets. I'd go with nginx as a reverse proxy, though. it has other benefits beside directly serving assets
[09:41:51] tbuehlmann: great, you just need to configure it properly then
[09:56:56] tbuehlmann: you're welcome!
[11:22:49] tbuehlmann: how do you generate the links? can you gist the server log for these requests?
[11:29:54] tbuehlmann: looks good to me
[11:34:20] tbuehlmann: ah, so it's probably the nginx configuration?
[11:46:38] tbuehlmann: you could start by just having a config for /assets
[11:49:23] tbuehlmann: (and probably /packs)
[12:43:52] tbuehlmann: catbusters: spring shouldn't generate that file, bundle install should
[12:49:37] tbuehlmann: regardless of whether spring was responsible for this, I can't recommend enough to not use spring at all
[13:00:02] tbuehlmann: spring just tries to speed up your rails processes. if you don't use spring, it'll work nontheless

2019-02-10

[11:43:07] tbuehlmann: jason479: what's the question?
[11:50:24] tbuehlmann: you can nest B inside the A namespace
[11:51:14] tbuehlmann: credentials don't support environment specific credentials yet
[11:51:22] tbuehlmann: you can keep two files
[11:52:21] tbuehlmann: https://gist.github.com/tbuehlmann/671fca8fa29122b39ac9d66b963467ce
[11:53:50] tbuehlmann: it depends on your deployment strategy, I'd say. if you're on heroku, use environment variables. if you're deploying with capistrano, use config files on the server. if it's none of that, you can still use the "old" config/secrets.yml file which is aware of environments
[11:55:59] tbuehlmann: you can also use rails 6.0.0.beta1 which should support environment specific credentials
[11:56:24] tbuehlmann: haven't followed if it's actually in, maybe this helps: https://github.com/rails/rails/pull/33521