Activity Graph

Page 1 of 1


[19:10:22] boxmein: Quit: ZNC 1.6.1 -
[19:11:30] boxmein: has joined #RubyOnRails
[22:29:21] boxmein: has left #RubyOnRails: ("WeeChat 2.1")


[02:47:13] boxmein: *.net *.split
[02:47:49] boxmein: has joined #RubyOnRails


[12:25:55] boxmein: *.net *.split
[12:27:36] boxmein: has joined #RubyOnRails
[15:01:26] boxmein: *.net *.split
[15:03:03] boxmein: has joined #RubyOnRails


[06:37:14] boxmein: Ping timeout: 260 seconds
[06:40:22] boxmein: has joined #RubyOnRails


[16:24:33] boxmein: *.net *.split
[16:27:01] boxmein: has joined #RubyOnRails


[07:08:12] boxmein: Ping timeout: 256 seconds
[07:16:22] boxmein: has joined #RubyOnRails


[23:23:17] boxmein: Ping timeout: 256 seconds
[23:24:09] boxmein: has joined #RubyOnRails


[01:17:11] boxmein: Ping timeout: 260 seconds
[01:20:06] boxmein: has joined #RubyOnRails


[16:59:09] boxmein: Ping timeout: 264 seconds
[16:59:38] boxmein: has joined #RubyOnRails


[02:32:41] boxmein: *.net *.split
[02:36:17] boxmein: has joined #RubyOnRails


[20:45:56] boxmein: Ping timeout: 259 seconds
[20:51:48] boxmein: has joined #RubyOnRails


[20:34:08] boxmein: Ping timeout: 248 seconds
[20:43:00] boxmein: has joined #RubyOnRails


[16:19:54] boxmein: *.net *.split
[16:20:13] boxmein: has joined #RubyOnRails


[04:29:50] boxmein: *.net *.split
[04:33:45] boxmein: has joined #RubyOnRails


[08:03:58] boxmein: Ping timeout: 255 seconds
[08:11:46] boxmein: has joined #RubyOnRails


[04:24:31] boxmein: Ping timeout: 248 seconds
[07:29:22] boxmein: has joined #RubyOnRails


[16:20:11] boxmein: is there a way to batch load has_many with conditions
[16:20:28] boxmein: say, if an actuator has_many reports, but we only care about the last report over say ~10 actuators
[16:20:55] boxmein: I could do it with a raw select I guess but is there a more rails way of doing it


[17:00:15] boxmein: how would you suggest I do authorization for a ~6-deep tree of resources
[17:00:43] boxmein: aka, Account has_many Location has_many Controller has_many Zone has_many Sensor
[17:00:51] boxmein: where Location is the main resource for cancancan authorization
[17:01:38] boxmein: ie, User alpha should have role in Location Y giving them access to Controller, Zone and Sensor, while user beta has role in Location Y giving them access to Controller and Zone but not Sensor
[17:02:54] boxmein: right now my system is doing can :manage, Sensor, { zone: { controller: { location_id: Location.with_role(:manager, user).pluck(:id) } } }
[17:34:12] boxmein: baweaver, true. so what you're saying is each User should have a Location role, Controller role, Sensor role
[17:34:48] boxmein: yeah, it would be a many-to-many
[17:35:12] boxmein: but... what confuses me is if I should have a role for each resource
[18:13:51] boxmein: cjohnson, I kinda wanna inherit the roles
[18:14:03] boxmein: just, I didn't have a good plan to do the inheritance nicely
[18:14:25] boxmein: I now ended up with a lot of cascaded rules
[18:14:41] boxmein: such as that you can manage a zone that has a controller that has a device that is in a location with THESE ids


[11:06:01] boxmein: has joined #RubyOnRails


[21:21:42] boxmein: *.net *.split
[21:22:30] boxmein: has joined #RubyOnRails
[23:26:27] boxmein: Ping timeout: 260 seconds


[12:03:20] boxmein: Read error: Connection reset by peer
[13:07:31] boxmein: has joined #RubyOnRails


[09:15:44] boxmein: Ping timeout: 260 seconds
[09:16:50] boxmein: has joined #RubyOnRails


[05:12:31] boxmein: Ping timeout: 240 seconds
[05:19:21] boxmein: has joined #RubyOnRails


[21:39:00] boxmein: Ping timeout: 260 seconds
[21:42:14] boxmein: has joined #RubyOnRails


[18:27:36] boxmein: Ping timeout: 255 seconds
[18:32:49] boxmein: has joined #RubyOnRails
[19:07:25] boxmein: Ping timeout: 246 seconds
[19:16:48] boxmein: has joined #RubyOnRails


[05:11:12] boxmein: Ping timeout: 260 seconds
[05:14:01] boxmein: has joined #RubyOnRails


[17:49:34] boxmein: Quit: ZNC 1.6.1 -
[17:54:29] boxmein: has joined #RubyOnRails


[21:02:37] boxmein: having a really odd syntaxerror
[21:02:48] boxmein: so I'm using ES6 classes without a worry in the world in one of my scripts
[21:03:01] boxmein: and I didn't add a transpiler for them
[21:03:49] boxmein: getting this error:
[21:03:57] boxmein: ActionView::Template::Error (SyntaxError: Unexpected token: name (SensorChart)):
[21:04:03] boxmein: where SensorChart is the name of an ES6 class
[21:16:41] boxmein: seems like it's related to js_compressor = :uglifier
[21:17:03] boxmein: if I include sprockets/es6 will it start supporting? time to find out.
[22:04:08] boxmein: so I fixed it by setting up sprockets properly (by using .es6 file extensions for es6-) and requiring the libs in application.rb


[01:36:40] boxmein: has left #RubyOnRails: ("i accidentally shift-clicked a channel probably")


[00:36:10] boxmein: has joined #RubyOnRails
[00:36:26] boxmein: heyo, I can't figure out why I can't load my database schema into postgres D:
[00:40:42] boxmein: matthewd: was preparing it, here it is:


[18:00:47] boxmein: has joined #RubyOnRails
[18:01:00] boxmein: I dun goofed but it seems like it's not my fault
[18:01:49] boxmein: I hit a "database configuration does not specify adapter" but only when I push to heroku
[18:02:04] boxmein: rhizome: this is my database.yml
[18:03:14] boxmein: (and this is the entire thing)
[18:03:28] boxmein: bricker: tbh it's sinatra I use but activerecord seems more popular on rails so I came here first
[18:05:10] boxmein: heroku should replace database.yml with its own and run RAILS_ENV=production rackup
[18:06:41] boxmein: nice last name
[18:08:33] boxmein: might the database config error be related to "could not detect rake tasks"
[18:26:09] boxmein: has left #RubyOnRails: ("whoops")


[00:04:37] boxmein: Ping timeout: 264 seconds
[00:51:18] boxmein: has joined #RubyOnRails
[00:53:25] boxmein: has left #RubyOnRails: ()


[13:35:15] boxmein: has joined #RubyOnRails
[17:47:04] boxmein: Ping timeout: 255 seconds


[11:38:28] boxmein: has joined #RubyOnRails
[11:38:41] boxmein: has left #RubyOnRails: ()


[17:13:39] boxmein: has joined #RubyOnRails
[17:13:56] boxmein: I'll gnaw my head off
[17:14:04] boxmein: can anyone help me with this erorr
[17:14:10] boxmein:
[17:14:16] boxmein: HasManyThroughAssociationNotFoundError
[17:14:24] boxmein: points at this line
[17:14:36] boxmein: and this is the schema
[17:18:23] boxmein: FunkyPajamas: honestly, I'm a huge beginner with this kind of relationing
[17:18:45] boxmein: FunkyPajamas: do I just add belongs_to to both sides?
[17:18:53] boxmein: FunkyPajamas: aka vote belongs to the quote and to the user
[17:20:41] boxmein: FunkyPajamas: I'm secretly doing this in sinatra but since rails is a way bigger community based on the same active* libraries this seemed a more attractive place to ask
[17:21:05] boxmein: FunkyPajamas: I did a belongs_to in a migration,
[17:21:08] boxmein: FunkyPajamas: is this also necessary
[17:21:35] boxmein: rails seems too mvc-y for me :P
[17:21:43] boxmein: although what I do is still a mvc :P
[17:26:26] boxmein: FunkyPajamas: considering the other two models, should the models/Vote.rb look something like
[17:33:42] boxmein: I don't think I am
[17:34:07] boxmein: FunkyPajamas: I'm not sure what the naming conventions are :P
[17:34:17] boxmein: FunkyPajamas:
[17:37:53] boxmein: FunkyPajamas: ohh
[17:38:11] boxmein: FunkyPajamas: sounds great!
[17:39:20] boxmein: FunkyPajamas:
[17:39:22] boxmein: FunkyPajamas: seems the same
[17:50:40] boxmein: FunkyPajamas: was I supposed to also modify the schema?
[17:50:44] boxmein: FunkyPajamas: because I did not
[17:51:58] boxmein: FunkyPajamas:
[18:03:02] boxmein: FunkyPajamas: :
[18:07:29] boxmein: FunkyPajamas: that cleared the first error, the second error's message was clearer too and I added source: :user/:quote respectively, and now there's no errors related to the database!
[18:07:43] boxmein: a strange Rack::Lint::LintError about a status being <100
[18:07:55] boxmein: but I think I'll handle it
[18:07:59] boxmein: FunkyPajamas: thanks a lot :D
[18:20:06] boxmein: FunkyPajamas: related question to the errors, what is all that I need to do to wire up a new Vote object now?
[18:20:11] boxmein: FunkyPajamas: not sure if this is enough,
[18:29:55] boxmein: FunkyPajamas: /query <username> should open up a new tab with a specific user
[18:30:14] boxmein: FunkyPajamas: and /msg <username> <message...> should send just one private message
[18:33:14] boxmein: FunkyPajamas: just poking again, wonder if I can validate uniqueness of a specific user/vote pair
[18:33:23] boxmein: FunkyPajamas: so an user can only vote once on a specific thing
[18:36:51] boxmein: sure thing
[19:02:25] boxmein: if I have three models, user { has_many votes }, vote { belongs_to user, belongs_to quote }, quote { has_many votes }
[19:02:46] boxmein: wonder if I can check a vote for uniqueness in the ActiveRecord::Base derived class
[19:08:13] boxmein: tbuehlmann: does validates :quote, uniqueness: { :scope => :user } look right
[19:08:38] boxmein: tbuehlmann: inside models/Vote.rb
[19:09:11] boxmein: busterarm:
[19:09:18] boxmein: busterarm: not sure what exactly you mean
[19:12:54] boxmein: busterarm: sorry, this is kinda the first time I'm playing around with activerecord and relations
[19:13:08] boxmein: relations make sense were I to make them myself but not when activerecord magic does them for me
[19:14:06] boxmein: busterarm: isn't :voters a Quote.rb field?
[19:14:18] boxmein: busterarm: or is that related to validates :quote
[19:15:31] boxmein: yea, I wanna validate that one person can vote once
[19:19:14] boxmein: yes, the pair of [user,quote] should be unique
[19:23:29] boxmein: I was about to ask why it should be two directions
[19:24:17] boxmein: also can I search for objects like Vote.where(:quote => quote, :user => user), where :quote and :user are both relation-defined (not actually in the database) and quote, user are respective objects
[19:32:30] boxmein: busterarm: I think I'm doing that maybe
[19:32:38] boxmein: busterarm: if you wanna, you can look at db/schema.rb
[21:02:10] boxmein: has left #RubyOnRails: ("whoops")


[21:36:34] boxmein: has joined #RubyOnRails
[21:36:49] boxmein: technically not rails but it's an activerecord question
[21:36:58] boxmein: I have and would like to know how the hell associative tables are assigned
[21:37:30] boxmein: aka if I have three models, two of which `has_many :votes`, and the third being the vote model, how do I make a vote
[21:38:05] boxmein: do I do something like `user.votes <<` and hope for the associations to apply magically
[21:38:18] boxmein:
[21:38:52] boxmein: I have three models, User, Quote and Vote
[21:39:29] boxmein: User and Quote have `has_many :voters, through: :votes`
[21:39:51] boxmein: aka Quote has many voters, and User has many quotes they have voted on
[21:40:48] boxmein: what's the difference between which pastebin I use
[21:40:54] boxmein: sure, gist is version controlled
[21:41:19] boxmein: anyway I digress
[21:42:14] boxmein: once the models are set, how do I actually assign the vote
[21:42:18] boxmein: do I create a new Vote via
[21:42:27] boxmein: do I assign it to both the user and the quote
[21:43:02] boxmein: also, are the voters / voted_quotes lists ?
[21:50:35] boxmein: has left #RubyOnRails: ("whoops")


[12:34:18] boxmein: arbitrary question, if I require a and then b right after, can b access whatever a defined?
[12:34:44] boxmein: well, right and left justification in those functions should just be adding spaces to the string on the given side until the string length is equal
[12:36:27] boxmein: def rjust str, length \n\t str = ' ' + str while str.length < length \n\t str \n end
[12:37:29] boxmein: shevy: say I made a rakefile, and wanted some tasks to be in a different file
[12:37:54] boxmein: does require './partials/a.rb' mean that a.rb also has rake in its scope? :D
[12:38:05] boxmein: that's why I first asked about ruby
[12:38:31] boxmein: as in, can I use task/file/directory/Rake::* inside partials/a.rb too
[12:40:55] boxmein: still, given I had a file structure like
[12:41:13] boxmein: would a.rb and b.rb work perfectly just by the virtue that a rakefile includes them


[21:52:58] boxmein: stupid ruby programmer question: why does line 50 fail with :34:in `request_delay': undefined local variable or method `lastrequest' for main:Object (NameError)
[21:54:32] boxmein: sigh I didn't include line numbers?
[21:55:27] boxmein:
[21:55:41] boxmein: line 23 here
[21:57:33] boxmein: It's just an one-time script so I didn't bother making classes and modules and whatnot
[21:57:41] boxmein: a onetime*
[21:58:09] boxmein: I would, if I wouldn't be self-conscious about what I'm writing
[21:58:43] boxmein: so I really don't want to share it aside from when I get it done or something
[21:59:24] boxmein: also, I wouldn't call the rest of the code exactly best practices
[22:01:21] boxmein: ACTION sighs
[22:05:14] boxmein: can I expect lastrequest to keep state between executions if it's defined inside the block
[22:05:17] boxmein: but yeah, global should work
[22:05:26] boxmein: wondered if I could avoid it
[22:05:29] boxmein: anyway entire code
[22:05:59] boxmein: every language's scoping rules are different
[22:06:03] boxmein: some are deathly simple
[22:06:04] boxmein: some are Ruby
[22:07:41] boxmein: inside the method's body
[22:07:48] boxmein: blocks being things messes up my vocabulary
[22:08:16] boxmein: Javascript's scoping is deadly simple, variables are function-local and nested functions get their own variables plus scope from above (both read and write)
[22:08:26] boxmein: Python's is so-so, you get scope from above unless you start writing
[22:09:14] boxmein: Java is hell, you get instance variables and nothing else from above, if you nest a class instance (which is how java does callbacks ) then it does not get variables from above, but it does get its instance variable
[22:10:02] boxmein: int blah = 5; new OnClickHandler() { @Override \n public void clicked(ClickArguments args) { blah does not exist here; } };
[22:14:10] boxmein: godd2: thanks for the link!


[14:28:28] boxmein: does ruby have something trivial I can shove a 'file format description' and a file into to return a data structure