thorgi

Activity Graph

Page 1 of 1

2016-07-29

[07:27:34] thorgi: Ping timeout: 240 seconds
[07:28:22] thorgi: has joined #RubyOnRails
[07:28:22] thorgi: has joined #ruby

2016-06-23

[20:27:36] thorgi: *.net *.split
[20:27:45] thorgi: has joined #RubyOnRails
[20:27:45] thorgi: has joined #ruby

2016-06-09

[10:08:30] thorgi: has joined #RubyOnRails
[10:08:30] thorgi: has joined #ruby

2016-06-06

[06:25:21] thorgi: Remote host closed the connection

2016-06-01

[18:28:34] thorgi: Ping timeout: 240 seconds
[18:30:05] thorgi: has joined #ruby
[18:30:05] thorgi: has joined #RubyOnRails

2016-05-18

[05:12:55] thorgi: Ping timeout: 246 seconds
[10:52:01] thorgi: has joined #ruby
[10:52:01] thorgi: has joined #RubyOnRails

2016-05-06

[11:27:11] thorgi: anyone using delayed_job and knows why a single worker would lock all jobs (instead of them running in parallel)?

2016-05-05

[13:49:57] thorgi: soahccc: "W3C recommends that all web servers support semicolon separators in addition to ampersand separators" - from https://en.wikipedia.org/wiki/Query_string
[13:54:18] thorgi: soahccc: I think 90% of internet don't use it, and probably not all HTTP servers support it, best to use &, and escape ; if needed as part of value
[13:54:36] thorgi: soahccc: but seems to be there as part of "standard"

2016-05-03

[17:28:10] thorgi: is there a way to combine ActiveRecord::Relation of different model objects into 1 relation for further querying? E.g. all_apps = Type1Apps.all + Type2Apps.all, then later all_apps.where(condition), obviously the condition operates on attributes present in both models
[17:43:56] thorgi: smathy: thanks, thought so, causes some code wet-ness, but not terrible I guess
[17:44:59] thorgi: smathy: ty, will search for them

2016-05-02

[15:21:37] thorgi: Remote host closed the connection

2016-04-28

[18:28:18] thorgi: can an object be Marshal.dump()ed in chunks, or a more memory-efficient version of dump?

2016-04-27

[08:11:12] thorgi: Ping timeout: 246 seconds
[08:16:51] thorgi: has joined #ruby
[08:16:51] thorgi: has joined #RubyOnRails

2016-04-21

[11:20:21] thorgi: has joined #ruby
[11:20:21] thorgi: has joined #RubyOnRails

2016-04-20

[18:20:34] thorgi: Remote host closed the connection

2016-04-14

[04:31:25] thorgi: Ping timeout: 276 seconds
[04:31:41] thorgi: has joined #RubyOnRails

2016-04-13

[22:08:04] thorgi: Ping timeout: 260 seconds
[22:09:20] thorgi: has joined #RubyOnRails

2016-04-05

[13:22:06] thorgi: *.net *.split

2016-04-04

[06:35:07] thorgi: has joined #RubyOnRails
[06:39:26] thorgi: Ping timeout: 248 seconds
[06:40:13] thorgi: has joined #RubyOnRails

2016-04-03

[19:23:15] thorgi: Ping timeout: 248 seconds

2016-03-28

[10:07:38] thorgi: Remote host closed the connection
[10:20:10] thorgi: has joined #RubyOnRails

2016-03-11

[23:46:03] thorgi: Ping timeout: 240 seconds
[23:54:05] thorgi: has joined #RubyOnRails

2016-03-10

[19:35:57] thorgi: Ping timeout: 246 seconds
[19:44:35] thorgi: has joined #RubyOnRails
[19:49:16] thorgi: Remote host closed the connection
[19:50:27] thorgi: has joined #RubyOnRails

2016-02-29

[21:15:45] thorgi: Remote host closed the connection
[21:17:24] thorgi: has joined #RubyOnRails
[21:22:17] thorgi: Ping timeout: 260 seconds
[21:22:37] thorgi: has joined #RubyOnRails

2016-02-26

[17:20:42] thorgi: *.net *.split

2016-02-19

[22:57:33] thorgi: Ping timeout: 240 seconds
[23:04:22] thorgi: has joined #RubyOnRails
[23:08:29] thorgi: Ping timeout: 240 seconds
[23:09:32] thorgi: has joined #RubyOnRails

2016-02-17

[09:52:41] thorgi: *.net *.split
[09:53:20] thorgi: has joined #RubyOnRails

2016-02-08

[15:10:14] thorgi: Is there a gem or core function that builds nested 'errors' hash for all associated models? E.g. if Model1 has_many of Model2, Model1.validate will just put 'Model2 is invalid' in Model1.errors

2016-02-05

[21:54:47] thorgi: has joined #RubyOnRails
[22:01:52] thorgi: hi all - is it possible to have model validation errors repeated for each instance of nested attributes? E.g. in a typical "author has many books and accepts its nested attributes, book belongs to author" scenario, Author.new({"books_attributes"=>{"0"=>{"title"=>{""}}, "1"=>{"title"=>""}}}) with title precence validation will only give me the presence error once in Author.errors
[22:02:07] thorgi: but I'd like to attribute specific errors to specific instances of the nested form

2016-01-26

[21:20:27] thorgi: Remote host closed the connection

2016-01-20

[19:37:54] thorgi: is it possible to have Model_A, which has_many Model_Bs, which in turn has_many Model_Cs, and have Model_A with accepts_nested_attributes_for all the way for Model C (assuming appropriate view with 2 levels of nested forms)?

2016-01-10

[07:04:35] thorgi: Ping timeout: 246 seconds
[07:06:03] thorgi: has joined #RubyOnRails
[07:11:06] thorgi: Remote host closed the connection
[07:11:27] thorgi: has joined #RubyOnRails

2016-01-09

[03:11:52] thorgi: *.net *.split
[03:22:13] thorgi: has joined #RubyOnRails

2016-01-08

[16:49:47] thorgi: has joined #RubyOnRails
[16:50:14] thorgi: hi, how would I go about adding a help message (to be displayed in view) to every model attribute? a virtual model attribute which is a hash keyed by attribute name maybe, or something more global perhaps, which isn't repeated for each object instance?
[16:53:01] thorgi: ok, never used i18n, not sure how to access the messages stored there, but will have a look
[16:53:39] thorgi: thanks all
[16:55:36] thorgi: seanhandley: perfect, exactly what I need, ty

2015-12-30

[19:29:49] thorgi: Remote host closed the connection

2015-12-22

[12:36:50] thorgi: Ping timeout: 245 seconds
[12:36:57] thorgi: has joined #RubyOnRails

2015-12-13

[19:35:54] thorgi: *.net *.split
[19:35:58] thorgi: has joined #RubyOnRails

2015-12-02

[15:36:10] thorgi: *.net *.split
[16:28:43] thorgi: has joined #RubyOnRails

2015-11-29

[21:11:25] thorgi: *.net *.split
[21:27:57] thorgi: has joined #RubyOnRails
[22:18:11] thorgi: *.net *.split
[22:53:19] thorgi: has joined #RubyOnRails

2015-11-26

[07:56:21] thorgi: has joined #RubyOnRails

2015-11-22

[03:39:13] thorgi: Ping timeout: 264 seconds

2015-11-19

[00:00:01] thorgi: matthewd: what sort of cache?
[00:03:39] thorgi: matthewd: lovely, even with a similar external API example to what I need, thanks!

2015-11-18

[23:38:53] thorgi: what's best place for session-duration caching of complex objects, is it just session hash and db/memcache backend for it, or a better place?
[23:44:33] thorgi: Radar: non-fixed (if I understand the question), they have dynamically created attributes; they're not AR/model objects, they're created by external module from slow API calls, hence attempt to make those calls at logon, then cache for the time of session
[23:45:57] thorgi: Radar: okay, that's that session hash backed by DB would effectively do by serialising them I understand, do you say there are additional risks to storing in session that can be avoided by own implementation?
[23:47:48] thorgi: Radar: yep, the default is 4KB I think, but rails' session hash can be told to store in DB or memcache, or probably other places, I'm assuming that removes the size limit
[23:48:06] thorgi: Radar: but I'm blind to what other things are done to session hash otherwise, could be another risk that I don't see
[23:49:48] thorgi: so large-ish external API data pertinent to the user logged in stored for session duration - best place session hash backed by DB?
[23:56:32] thorgi: matthewd: yep, will have to bite that - should still be considerably faster than the API (definitely atm, as queries go over internet), later the rails app will be closer network-wise to the API (local network), but one big API dump + DB queries and de-serialisation will hopefully still be faster than many small API calls

2015-11-17

[13:42:15] thorgi: has joined #RubyOnRails
[13:50:06] thorgi: hi all - what's the best way of custom-associating ActiveRecord with another bespoke class, e.g. AR class Project has an 'owner' attribute (string), but that needs to be dynamically associated with a User object, except User is not AR and doesn't come from DB, it's an existing class that queries LDAP+Kerberos etc
[13:54:28] thorgi: rvanlieshout: in Project model? I do need the owner string value from Project model / DB, which I use to look up LDAP+KRB, but then I'd like to replace the AR::Relation value of owner from the string, with a full non-AR object, that seems to work in a way, except Rails appears to be calling .to_s on my non-AR object, yielding a string in the end as well, instead of assigning full object
[13:54:53] thorgi: tried write_attribute() as well, same effect, unless I'm not supposed to change the ::Relation
[13:56:46] thorgi: rvanlieshout: I'm looking to have that property value as a full non-AR object, so I can show more of its properties in view (those properties don't come from DB though, but from an LDAP query)
[13:57:30] thorgi: rvanlieshout: maybe I'm trying to hard to associate it at model end, and should do it in controller (e.g. @project.owner == @user.uid, then ...)
[14:00:09] thorgi: actually, I think just another instance var in Project model, populated with a handle to the non-AR User object, will allow that project to always carry a reference (once populated of course)
[14:00:39] thorgi: and I'll keep owner attribute untouched, since it's a DB column as well, so would complicate save method
[14:14:27] thorgi: rvanlieshout: just a plain old Ruby object, not subclassing ActiveRecord... I've got this now in Project model 'def owner; IPA::IPAUser.find(nil, uid: read_attribute(:owner)).first; end'
[14:15:08] thorgi: rvanlieshout: but in the final @project instance of this Project model, owner attribute still returns just String, instead of the IPAUser object, basically it seems to be calling .to_s on it somewhere silently along the way
[14:16:10] thorgi: rvanlieshout: that said, I think I should probably not be replacing an attribute of Project model that is associated with database, and instead have another private attribute
[14:18:56] thorgi: rvanlieshout: wouldn't that lead to problems with save, in that the owner attribute no longer carries a string when it tried to commit to database (although my replacement object does respond correctly to to_s)?
[14:22:43] thorgi: rvanlieshout: okay, the source location gives me this [".../app/models/project.rb", 11]
[14:23:40] thorgi: rvanlieshout: also, this correctly populates the class' name into owner attribute "def owner; IPA::IPAUser.find(nil, uid: read_attribute(:owner)).first.class; end"
[14:23:51] thorgi: rvanlieshout: owner values ends up as 'IPA::IPAUser'
[14:24:36] thorgi: rvanlieshout: but object assignment does a .to_s() somewhere, cause instead of full object I end up with just UID of the user (which is returned by IPA::IPAUser instances' to_s)
[14:28:36] thorgi: rvanlieshout: will try to wrap it into a gist, thanks for persisting