solars

Activity Graph

Page 1 of 17 | Next »

2019-06-13

[23:50:18] solars: Quit: Connection closed for inactivity

2019-06-03

[07:47:53] solars: *.net *.split
[07:52:50] solars: has joined #ruby
[12:48:30] solars: Ping timeout: 252 seconds
[12:51:16] solars: has joined #ruby

2019-05-24

[07:37:50] solars: Ping timeout: 252 seconds
[07:43:34] solars: has joined #ruby

2019-05-18

[06:00:20] solars: has joined #ruby
[06:01:33] solars: hi, is there any chatbot framework for FB or telegram that actually supports something like Alexa/Snips has, where you define patterns for sentences and variable slots?

2018-03-20

[11:43:25] solars: has joined #RubyOnRails
[11:44:04] solars: hey, is anyone using AWS ECS and can tell me how I would separate the database container from my app when using task definitions?
[14:29:50] solars: Ping timeout: 260 seconds

2018-01-23

[09:49:23] solars: has joined #RubyOnRails
[09:50:57] solars: quick question: (rails 4 but maybe someone can help): I had to change from Cookie to AR Session store due to SSO. I noticed that the app generates "empty" (non logged in users) sessions everytime a livecheck hits a certain URL. Is this the case generally, and how do people handle it?
[14:34:06] solars: Quit: Page closed

2017-12-14

[14:13:18] solars: has joined #RubyOnRails
[14:17:29] solars: quick question: when using find_each, rails automatically orders on the primary key. If I have custom query that uses group however, I cannot use the primary key but need to use it in an aggregate function like max(table.id) in Postgres. The problem is that find_each does not let me specify a custom order column, does anyone know a workaround for this?
[14:49:12] solars: pwnd_nsfw: yes, I'm still using the PK, however, if I aggregate I need to have it in a pseudo aggregation in PG as well
[15:23:47] solars: Quit: Page closed

2017-11-28

[12:41:34] solars: has joined #RubyOnRails
[12:42:35] solars: quick question: how can I use a method defined in a concern, which is included in the application_controller, in a before filter in a normal controller?
[12:42:45] solars: it's an authentication method that i want to extract out
[13:48:36] solars: Quit: Page closed
[14:08:12] solars: has joined #RubyOnRails
[14:08:37] solars: hi, does anyone know how to specify a rescue_from inside the application_controller to avoid duplication? it doesn't seem to work if not specified in the individual controllers
[15:33:51] solars: Quit: Page closed

2017-11-27

[19:13:58] solars: has joined #ruby
[19:16:03] solars: hey, I'm extending a very simple gem, but cannot find out where the variable callback_url here comes from: https://github.com/dlindahl/omniauth-cas/blob/master/lib/omniauth/strategies/cas.rb#L91 does anyone see this?
[19:19:41] solars: ah damn, it's probably coming from Omniauth
[19:19:49] solars: which is included, but obviously the sources are not in this repo
[19:35:56] solars: Quit: Page closed
[20:31:45] solars: has joined #RubyOnRails
[20:32:27] solars: hey, if I use the ActiveRecord session store, what's the best way to delete a particular users session from it? (I'm receiving the UID from the SSO service)
[22:25:30] solars: Quit: Page closed

2017-11-23

[08:34:48] solars: has joined #RubyOnRails
[08:37:39] solars: hi, auth question: I need to add either CAS or Openid Connect auth to my application. However, if there is a parameter api_token, I have to do it in a custom filter. What would you recommend to use here? Is this possible with devise or omniauth or should I look at something different?
[08:39:15] solars: I thought so, I don't want to overcomplicate it though
[08:39:33] solars: I'm not sure what makes sense to use
[09:08:17] solars: what I'm asking myself basically is if I should use omniauth with the openid-connect provider, or devise
[10:17:55] solars: sevenseacat: for some maybe, yes
[10:18:46] solars: it's not really a big issue though, just selecting a client lib
[14:40:16] solars: Quit: Page closed

2017-11-22

[14:52:42] solars: has joined #RubyOnRails
[14:53:17] solars: can anyone recommend a plugin for authentication against a CAS server?
[15:12:27] solars: fryguy: the build is failing and it seems outdated..
[16:30:39] solars: Quit: Page closed

2017-11-13

[10:28:16] solars: has joined #RubyOnRails
[10:43:35] solars: hey, I'm using ActiveRecord::Base.connection.exec_query(query) but keep getting strings for integer types (see https://gist.github.com/solars/026ee1c7e5072c088483d40173b543cd) - can anyone tell me how to avoid this?
[13:22:32] solars: Quit: Page closed

2017-11-11

[19:50:34] solars: Quit: Page closed

2017-11-10

[16:02:46] solars: has joined #RubyOnRails
[16:03:27] solars: hi, quick question: I'm not getting any types (integer, etc), only strings with ActiveRecord::Base.connection.exec_query(query.to_sql) - how can I change it so types are automatically inferred?

2017-10-20

[09:01:16] solars: has joined #RubyOnRails
[09:02:40] solars: hi, quick question: if I return false in a before_save, I get ActiveRecord::RecordNotSaved - is there any way to do this silently? I need to send an email instead for debugging passenger
[09:21:59] solars: Quit: Page closed

2017-10-17

[07:06:06] solars: has joined #RubyOnRails
[07:06:35] solars: hi, when doing a PG raw query: ActiveRecord::Base.connection.execute("select booking_count from statistics").first I keep getting a hash with integer db fields as strings - how can I get the right types?
[07:49:37] solars: dminuoso: what is the difference between the two?
[07:50:54] solars: ah, good to know, thank you!
[07:51:27] solars: still have to find a way to map to the correct types
[07:51:44] solars: the mysql driver seems to have done this automatically
[08:10:39] solars: Ping timeout: 260 seconds
[08:11:12] solars: has joined #RubyOnRails
[13:58:57] solars: Quit: Page closed

2017-10-16

[15:01:25] solars: has joined #RubyOnRails
[15:03:18] solars: hi, when doing a PG raw query: ActiveRecord::Base.connection.execute("select booking_count from statistics").first I keep getting a hash with integer db fields as strings - how can I get the right types?
[15:52:24] solars: Ping timeout: 260 seconds

2017-10-03

[07:55:14] solars: has joined #RubyOnRails
[07:57:18] solars: hi, I've got problems comparing timestamps in Rspec, especially AR Objects to the same attribute returned on an endpoint. How do you generally compare this? I noticed differences in milliseconds, formats, etc - e.g. I just tried expect(DateTime.parse(resp['result']['last_generated']).rfc2822).to eq metadata.generated_timestamp.rfc2822 but get 02 Dec vs 2 Dec
[08:40:50] solars: doesn't the rspec be_within matcher work with datetimes? I found it somewhere, tried in rails but expect(DateTime.parse(timestamp)).to be_within(1.minute).of timestamp says TypeError: expected numeric
[10:38:17] solars: Quit: Page closed

2017-09-13

[13:17:43] solars: has joined #RubyOnRails
[13:18:54] solars: quick question: if I have a PG db, with a specific schema I know I can specify it with schema_search_path - but how does this work if I want to create the db with rake, does it create the schema?
[18:03:34] solars: Ping timeout: 260 seconds

2017-09-06

[19:39:44] solars: Quit: Page closed

2017-09-05

[08:55:26] solars: has joined #RubyOnRails
[08:55:59] solars: quick question: does anyone know if activerecord ads a default order by .id when using .select in postgresql as opposed to mysql?
[09:07:38] solars: matthewd: good point - do you know if this is different from mysql to postgresql? and, how can I dump the query that is used in this case? as .first.to_sql won't work I guess
[09:09:27] solars: hm weird - I've got a mysql query (custom query, using .select) that I need to convert to pgsql and pgsql complains about the missing id
[09:09:33] solars: but it's working in mysql
[09:41:48] solars: btw is there any way to omit the ordering by id (with .select and .first) if I only need one record? The result contains sum only so an order doesn't make sense
[11:05:49] solars: defsdoor: thanks!

2017-07-25

[07:33:41] solars: has joined #RubyOnRails
[07:35:17] solars: hi, can anyone tell me how I would set a primary key on the schema_migrations table?
[07:35:23] solars: through a migration
[07:38:06] solars: Radar: Why does a PK seem bad? I need to normalize the DB in order to replicate it
[07:39:44] solars: I know what the table is for, and I don't see a reason why it should not be normalized
[07:40:25] solars: Radar: not with my db, but possible that it was added to rails at a later stage
[07:41:49] solars: sevenseacat: I have one column and there is no PK
[07:41:54] solars: as written above
[07:42:24] solars: as written I need to normalize the DB for replication, thus I need a PK
[07:42:54] solars: In english?
[07:43:27] solars: I need a PK because otherwise we cannot replicate this DB, it's a requirement
[07:48:03] solars: sevenseacat: thanks, the app is older
[07:48:46] solars: it's on rails 5, I'm not sure if rails automatically upgrades existing tables
[07:51:55] solars: that's weird then
[07:52:17] solars: added it manually for now
[07:55:55] solars: has left #RubyOnRails: ()

2017-06-09

[19:02:07] solars: has joined #ruby
[19:03:36] solars: hey, I've got the following Gemfile and test script, but keep getting /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundle/setup (LoadError)
[19:03:57] solars: with bundle exec sudo ruby test.rb - can anyone tell me what's wrong here?
[21:35:49] solars: Ping timeout: 260 seconds

2017-04-26

[13:41:44] solars: has joined #RubyOnRails
[13:42:33] solars: hey, quick rspec question: if I want to stub a class that is called outside of my spec, e.g. RestClient, is the correct way to do it with: RestClient = double; RestClient.stub(:get) {} ?
[13:56:42] solars: deur-: you're of course right in this example - I had instances in my mind, but obviously that's a different case
[13:57:10] solars: with instances it only works with expect_any_instance_of() - but this seems to be old. any idea how I would write this in the newer syntax?
[13:58:29] solars: hmm I thought that's old
[13:58:43] solars: expect is not the same as allow, right
[13:59:11] solars: the problem is if the object is created outside of your spec, you cannot directly use the double then
[14:00:24] solars: why is this under "how to work with legacy code" in the docs?
[14:00:28] solars: I don't get that
[14:08:40] solars: deur-: ah yeah that might make sense
[14:08:51] solars: it's a bit misleading :)
[14:39:08] solars: Quit: Page closed

2017-04-24

[10:50:17] solars: has joined #RubyOnRails
[10:51:08] solars: Client Quit

2017-04-20

[10:16:27] solars: has joined #RubyOnRails
[10:17:15] solars: quick question: I always get an empty flash with the following minimalistic controller/view - can anyone tell me why this is? I thought if I add it to redirect_to it should be displayed https://gist.github.com/solars/206a7e21755c068a810968b0ab36aaca still on rails 4.2
[10:21:58] solars: is this maybe because of the before action?
[10:25:16] solars: pawandubey: well they look normal
[10:32:31] solars: pawandubey: same result, doesn't help
[10:49:56] solars: pawandubey: how do you mean at the end?
[10:58:06] solars: pawandubey: it's the default new action (see view template in the gist)
[11:36:47] solars: Quit: Page closed

2017-04-06

[08:45:35] solars: has joined #ruby
[08:46:03] solars: quick question: wasn't there a shortcut to assign arguments of initialize to instance vars/accessors?
[09:49:21] solars: Mon_Ouie: sorry for the late reply, thanks!
[10:07:24] solars: Quit: Page closed

2017-03-29

[13:44:58] solars: has joined #RubyOnRails
[13:46:20] solars: hi, I've got a running rails app and now need to connect to a queue to poll events. Is it a good practise to do this in the app (schedule a background job that does this) or would you create a separate daemon?
[14:53:47] solars: Quit: Page closed

2017-03-28

[13:53:20] solars: has joined #RubyOnRails
[13:53:46] solars: hi, does anyone know how to get the actual instance, when using rspecs any instance of?
[14:07:46] solars: Quit: Page closed

2017-03-25

[20:35:37] solars: has joined #RubyOnRails
[20:38:58] solars: hi, can anyone recommend hosting options for a rails app with elastic, postgres, sidekiq, redis? https://github.com/LaCasemate/fab-manager/ they provide dockerfiles, but it needs at least 2GB ram. The cheapest I know is digitalocean 20$/month
[20:43:33] solars: that's what I thought
[22:07:38] solars: Quit: Page closed

2017-03-24

[08:19:04] solars: has joined #RubyOnRails
[08:20:58] solars: quick question: Any suggestinos for cheap hosting for a non time-critical rails app that provides a docker image and essentially depends on sidekiq, redis, postgresql, elasticsearch? Digitalocean instance? The app details are here: https://github.com/LaCasemate/fab-manager
[08:23:46] solars: kreantos: yes as mentioned :)
[16:50:00] solars: Ping timeout: 260 seconds

2017-03-20

[09:15:22] solars: has joined #RubyOnRails
[09:16:40] solars: quick question: in rspec, if I want to mock a method called .config on a particular Active Record instance (only one) - how would I do this?
[09:22:35] solars: tbuehlmann: that's what I tried - however, the instance (object in your example) that I use is not directly used in the code called, it's fetched from the database - so it's basically two different instances of the same object I assume?
[09:25:23] solars: tbuehlmann: the method I want to stub depends on some other models, it doesn't only check the record itself.
[09:26:27] solars: tbuehlmann: something like expect(Model.any_instance).to receive(:method) { return true if <instance>.id == 3 } would be handy
[09:26:41] solars: not sure if there is anything like that
[09:28:58] solars: tbuehlmann: the reason I'm a bit against that is that I want to isolate this as a unit test, and not setup the whole structure, that's why I want to stub the method.
[09:29:50] solars: tbuehlmann: I will do it like this for now, but I think it's not optimal
[10:39:15] solars: Quit: Page closed

2017-03-09

[11:02:24] solars: has joined #RubyOnRails
[11:04:15] solars: hi, I've got a controller streaming csv which suddenly stops at around 411k lines, although the result contains 1,3million - does anyone have an idea why? https://gist.github.com/solars/c5706f9e0e2ed31386c68fd737bbc139
[11:28:54] solars: Quit: Page closed
[14:53:17] solars: has joined #RubyOnRails
[14:54:04] solars: hi, how would I select records from a subquery returning ids, like this? Property.where(id: "select id from properties")
[14:55:58] solars: matthewd: epochwolf the actual subquery is a bit more complex, but it basically returns IDs of records that I'm interested in
[14:56:15] solars: matthewd: I'm not sure how I would integrated such a query in an active record query
[14:57:37] solars: matthewd: ah that was obvious
[14:57:38] solars: I guess this works
[14:57:58] solars: I'm not sure if there is a nicer way actually
[14:58:27] solars: epochwolf: I don't have the second query as AR/Arel, it's just a string
[14:59:09] solars: epochwolf: hmm maybe something like this would work as well: Property.select(id: Property.select("select id from properties"))
[14:59:13] solars: but it doesn't seem so
[14:59:33] solars: just for the sake of an example
[14:59:43] solars: the subquery model would be a different table
[15:00:23] solars: matthewd: haha don't let me confuse you sorry
[15:00:39] solars: matthewd: I was looking for a cleaner AR way, with where(id: ....)
[15:01:14] solars: nevermind, I confused myself, it's actually pretty clear
[15:01:59] solars: matthewd: epochwolf: I was looking for something like: Item.where(property: Property.where(query_string))
[15:02:14] solars: matthewd: replacing the sql string with arel is the second step
[15:02:19] solars: epochwolf: yeah I just realized
[15:02:30] solars: thanks guys :)
[15:03:45] solars: I think it does this automatically due to Model.select
[15:03:57] solars: Model.where, sorry
[15:13:22] solars: yeah it's integrated in the other query
[15:13:26] solars: if you use .to_sql
[15:13:35] solars: that's the nice part about Arel :)
[15:29:56] solars: epochwolf: matthewd: ok I've got to ask again, ArBudget.where(property: ArProperty.where("select id from ar_properties")) still doesn't work as .where and also .select only accept parts of the query, not a complete query
[15:30:34] solars: epochwolf: matthewd it's producing a nesting like: "SELECT `ar_budgets`.* FROM `ar_budgets` WHERE `ar_budgets`.`ar_property_id` IN (SELECT `ar_properties`.`id` FROM `ar_properties` WHERE (select id from ar_properties))"
[15:31:56] solars: matthewd: epochwolf: it's as I wrote before, I've got the complete subquery for ids, as a string
[15:32:45] solars: matthewd: epochwolf: my question is: given the query I just posted, how would I write it so I don't have to alter the sql string
[15:33:33] solars: meaning: how can I use ArProperty with a complete query as string
[15:34:18] solars: matthewd: not really, those were different versions
[15:34:23] solars: epochwolf: but that's only the where part
[15:35:30] solars: it boils down to ArProperty.where('select id from fubar where 1=1') - I think cpruitt is right
[15:36:06] solars: there is find_by_sql but it results in 2 calls afaik
[15:36:33] solars: matthewd: I know that I can write it as a single string like "id in (#{query})" but my second question was different to that
[15:37:40] solars: cpruitt: as mentioned it boils down to ArProperty.where('select id from fubar where 1=1') , but I think that's not possible
[15:38:23] solars: I can do it with find_by_sql - but I thought there might be something that results in a relation object
[15:38:37] solars: epochwolf: exactly
[15:39:25] solars: cpruitt: epochwolf understood it, it's fine
[15:39:46] solars: epochwolf: the code above is what is relevant, and you provided the right answer
[15:42:08] solars: cpruitt: not if the query includes a complex condition
[15:42:51] solars: cpruitt: that's why I mentioned "without altering the string"
[15:43:04] solars: cpruitt: but yeah, you understood what I wanted to know :)
[15:43:23] solars: cpruitt: it's coming from a third party component, the query, and is rather complex
[15:43:59] solars: epochwolf: no need to, it's working fine like this
[15:44:15] solars: what would be the reason for separation?
[15:44:47] solars: epochwolf: it's a trusted component, it just cannot be changed at this time
[15:46:40] solars: epochwolf: yes that's clear, but that's a trust issue, which is not relevant in this scenario
[16:22:32] solars: Quit: Page closed

2017-03-07

[11:55:58] solars: Quit: Page closed

2016-07-31

[18:15:04] solars: Ping timeout: 240 seconds
[18:15:11] solars: has joined #RubyOnRails
[18:15:11] solars: has joined #ruby
[23:09:44] solars: Ping timeout: 260 seconds
[23:21:59] solars: has joined #RubyOnRails
[23:21:59] solars: has joined #ruby

2016-07-28

[06:15:03] solars: Ping timeout: 265 seconds
[06:27:16] solars: has joined #RubyOnRails
[06:27:16] solars: has joined #ruby

2016-07-27

[06:02:12] solars: has joined #RubyOnRails
[06:02:12] solars: has joined #ruby
[14:31:52] solars: Ping timeout: 244 seconds
[17:21:34] solars: has joined #RubyOnRails
[17:21:34] solars: has joined #ruby
[19:20:50] solars: Ping timeout: 244 seconds
[19:39:22] solars: has joined #RubyOnRails
[19:39:22] solars: has joined #ruby

2016-07-26

[07:46:37] solars: anyone got an idea what I am doing wrong with prepend here? https://gist.github.com/solars/df2708e5147b0f47e74e4c25de8868c2
[07:52:32] solars: dminuoso, it returns Log4r::Logger
[07:53:49] solars: #<Method: #<Log4r::Logger:0x007f215801aec0 @fullname="complete", ...
[07:57:21] solars: [CustomWrapper, MyNewWrapper, MyWrapper, Log4r::Logger, Object, V8::Conversion::Object, ActiveSupport::Dependencies::Loadable, PP::ObjectMixin, OTA, IgnoreNil, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject]
[07:57:25] solars: which looks okay
[07:57:45] solars: note the other wrapper classes are tests as wlel
[08:03:43] solars: sorry had a phone call
[08:04:16] solars: instance_methods returns => [:error]
[08:07:50] solars: that should work with .singleton_class.prepend - right?
[08:09:25] solars: hm that seems to work
[08:09:49] solars: yeah.. I don't get it
[08:10:04] solars: thanks for the help though! I'll write up another gist
[08:10:41] solars: I'll just add the singleton_class way
[08:14:52] solars: dminuoso, yep I just tried it in the console
[08:15:42] solars: dminuoso, #<Class:#<Log4r::Logger:0x007f3d52dacd20>>
[08:16:00] solars: dminuoso, what does it show actually? never came across this
[08:16:23] solars: dminuoso, yes you are right
[08:16:30] solars: dminuoso, that's handy, nice
[08:17:46] solars: dminuoso, dminuoso thanks a lot for your help, now it's pretty clear
[08:18:20] solars: dminuoso, should read through the metaprogramming book once in a while :)
[08:30:30] solars: dminuoso, also a good choice :)
[08:30:44] solars: dminuoso, I tend to forget these things too fast
[08:31:53] solars: dminuoso, I'll read it, that sounds interesting
[08:32:02] solars: dminuoso, thanks!
[15:48:28] solars: Ping timeout: 264 seconds