« Back to channel list

#RubyOnRails - 26 June 2017

« Back 1 day Forward 1 day »
[00:02:23] openCircuit__: has joined #RubyOnRails
[00:02:30] comet23: Radar, but isn't that resource outdated?
[00:02:36] comet23: since rails is 5 now and that's rails 4?
[00:03:28] Radar: comet23: It'll still work for Rails 5. Everything is mostly the smae.
[00:03:53] comet23: what are the differences?
[00:03:57] comet23: i'm new to rails
[00:04:14] Technodrome: has joined #RubyOnRails
[00:04:29] Radar: http://edgeguides.rubyonrails.org/5_0_release_notes.html
[00:06:31] ascarter: has joined #RubyOnRails
[00:11:37] chare: why aren't you guys recommending him https://www.railstutorial.org/book
[00:13:40] Radar: chare: Because Rails 4 in Action is more thorough.
[00:13:43] Radar: Also: I wrote Rails 4 in Action.
[00:14:13] Radar: What Rails Tutorial covers in 14 chapters we cover in 6. Then there's still 9 more chapters to go.
[00:14:56] Radar: Where's file uploading in Hartl's tutorial? How about building an API? What about a chapter on Rack?
[00:20:00] umaaji: has joined #RubyOnRails
[00:20:35] comet23: Radar that link you gave me isn't very helpful... i am brand new to frameworks and rails
[00:21:11] chare: you gotta buy the book
[00:21:20] chare: that is what radar is saying
[00:21:23] comet23: i have a safari books subscription
[00:21:36] comet23: it has like every technical book in the market
[00:22:05] openCircuit__: has joined #RubyOnRails
[00:36:34] Radar: comet23: https://www.safaribooksonline.com/library/view/rails-4-in/9781617291098/
[00:36:37] Radar: oh would you look at that
[00:38:33] wethu: has joined #RubyOnRails
[00:41:51] openCircuit__: has joined #RubyOnRails
[00:42:22] chouhoulis: has joined #RubyOnRails
[00:44:33] rfoust: has joined #RubyOnRails
[00:46:57] Rodya_: has joined #RubyOnRails
[00:47:33] quazimodo: has joined #RubyOnRails
[00:58:19] xx00__: has joined #RubyOnRails
[01:00:15] arBmind: has joined #RubyOnRails
[01:01:37] openCircuit__: has joined #RubyOnRails
[01:03:21] manufv: has joined #RubyOnRails
[01:09:25] ascarter: has joined #RubyOnRails
[01:11:47] apparition: has joined #RubyOnRails
[01:21:21] openCircuit__: has joined #RubyOnRails
[01:38:51] sevenseacat: has joined #RubyOnRails
[01:39:34] elcontrastador: has joined #RubyOnRails
[01:41:06] openCircuit__: has joined #RubyOnRails
[01:57:33] Jameser: has joined #RubyOnRails
[02:00:00] comet23: Radar, is that a bad thing that it's on there?
[02:00:10] Radar: comet23: is that a serious question?
[02:00:34] Radar: comet23: If you're going to troll I am not interested in helping you.
[02:00:40] comet23: i'm not trolling
[02:00:52] openCircuit__: has joined #RubyOnRails
[02:00:57] comet23: i just don't understand why you would say oh would you look at that
[02:01:14] Radar: Because you clearly didn't look for it
[02:01:16] Radar: before asking for it
[02:01:19] comet23: no, i already saw it
[02:01:30] comet23: after you mentioned it i searched it and found it
[02:01:47] irishfromua: has joined #RubyOnRails
[02:02:24] comet23: i was asking for what the difference between version 4 and 5 is because i have never been exposed to major release version differences
[02:02:44] sevenseacat: we need a good rails 5 resource. sadly, none of us have found the time to write one yet
[02:02:56] comet23: now i am even more confused
[02:03:08] sevenseacat: hi, I also wrote Rails 4 in Action.
[02:03:33] comet23: sevenseacat why would you say we need a good rails 5 resource and then the other person say that it's good with minor differences
[02:03:51] sevenseacat: because I'm tired of having these discussions about there only being minor differences
[02:03:52] comet23: i was just asking for what the differences were and i'm now being called a troll =(
[02:04:43] comet23: that makes sense i guess, i hope i find someone who isn't tired of answering questions, i'll even pay them
[02:06:41] sevenseacat: we're not 'tired of answering questions'. bear in mind it's monday morning here, some of us might be a little short :)
[02:13:26] comet23: thank you sevenseacat and radar
[02:13:40] comet23: i just want to learn ruby on rails and become good at it and work for a company for fun
[02:14:04] comet23: if you're a student check out education.github.com
[02:14:20] comet23: they're giving away free bootcamps for 1 month as well as a bunch of other tools
[02:14:48] ascarter: has joined #RubyOnRails
[02:16:19] ishahnaz: has joined #RubyOnRails
[02:37:10] Rodya_: has joined #RubyOnRails
[02:51:25] Jameser: has joined #RubyOnRails
[02:55:37] Technodrome: has joined #RubyOnRails
[03:06:38] Jason: has joined #RubyOnRails
[03:07:04] Jason: what is the set_(modelname) function at the end of a controller?
[03:07:20] Jason: as seen here in todos_controller.rb for my todos model: https://gist.github.com/jasonharrison/0fb01748544e26e58e6bdb39ca5c9668
[03:07:49] sevenseacat: looks like a method you defined, then you'd probably call it in a before_action to share common setup for different actions
[03:08:35] Jason: the model included that method after i generated the scaffold
[03:08:42] Jason: s/model/controller/
[03:08:56] sevenseacat: okay, so the controller also would have a before_action to specify when that method should be called
[03:08:57] Jason: you are correct, though: the top of my controller does contain a before action: before_action :set_todo, only: [:show, :edit, :update, :destroy]
[03:09:17] sevenseacat: so it's sharing setup for those four actions
[03:09:21] Jason: sevenseacat: oh! i understand now
[03:09:36] sevenseacat: to save calling Todo.find in each of the
[03:09:42] Jason: so it's eliminating redundant lines
[03:09:51] Jason: i understand perfectly now
[03:09:53] Jason: thank you sevenseacat :)
[03:10:27] Jason: sevenseacat: i've been building small applications with flask for a few years and I've always stayed away from rails because of its learning curve
[03:10:40] Jason: i'm amazed at how much easier rails makes certain things
[03:10:42] sevenseacat: it does have a wee bit of a learning curve
[03:11:17] Jason: just as an exercise i'm building a todo list with authentication
[03:11:35] sevenseacat: sounds like a good starter project
[03:11:36] Jason: there is no doubt that the same application with flask would take significantly more time
[03:11:48] sevenseacat: thats interesting to hear
[03:11:53] sevenseacat: flask is python, yeah?
[03:12:30] Jason: sevenseacat: here's how I always set up my flask projects -- note how much rails does for you vs flask
[03:12:33] Jason: sevenseacat: https://github.com/jasonharrison/flaskel/blob/master/main.py
[03:13:14] sevenseacat: I don't know python very well so it looks like a jumble of unrelated things to me
[03:13:34] quirkycoders: has joined #RubyOnRails
[03:13:40] Jason: sevenseacat: basically i'm manually setting up a database connection, CSRF protection with forms, user authentication/storage is a huge pain
[03:14:13] Jason: then i have a decorator to require authentication from users prior to being able to access a portion of a website, and so on
[03:14:18] Jason: rails makes this SO much easier, haha
[03:14:36] Jason: anyway, thank you again
[03:15:02] quirkycoders: has joined #RubyOnRails
[03:16:00] quirkycoders: has joined #RubyOnRails
[03:17:23] quirkycoders: has joined #RubyOnRails
[03:18:20] aajjbb: has joined #RubyOnRails
[03:21:47] ascarter: has joined #RubyOnRails
[03:21:59] Jason: rails treats ActiveRecord::RecordNotFound errors as 404's? i'm in love
[03:23:15] Trynemjoel: has joined #RubyOnRails
[03:23:22] sevenseacat: it sure does :)
[03:25:35] Jason: my little app is done, took about ~45 minutes from start to finish (the vast bulk of that time reading docs)
[03:25:40] Jason: now to work on tests :)
[03:31:03] xco: has joined #RubyOnRails
[03:31:53] xco: hello. what can cause me to get uninitialized constant Admin (NameError) in this after upgrading to rails 5.0.4? any ideas?
[03:31:58] xco: https://gist.github.com/siaw23/3e505337ffe87ae7dbf3bf12ca918895
[03:37:22] Radar: maybe the admin constant is undefined
[03:37:34] Radar: just a thought
[03:37:42] Radar: ACTION opens the gist
[03:38:10] Radar: Yup, it's undefined. You'll need to define it: https://gist.github.com/radar/9e3803e63b09909b7573afc64293b281
[03:38:25] Trynemjoel: has joined #RubyOnRails
[03:39:06] quirkycoders: has joined #RubyOnRails
[03:48:57] harfangk: has joined #RubyOnRails
[03:50:07] Jason: sevenseacat: are you still about? running into some problems with testing, hah
[03:50:16] sevenseacat: sure am, whats up?
[03:51:57] Jason: sevenseacat: so i haven't even gotten into writing my own tests -- i just tried `rails test` on my cli and got all sorts of errors,
[03:52:01] Jason: sevenseacat: https://gist.github.com/jasonharrison/a36352c7f08495fc268f971d056959c0
[03:52:26] Jason: based on the output it appears this has to do with my authentication with devise
[03:52:37] Jason: but i'm not sure how i'd go about resolving that
[03:52:43] fugee: has joined #RubyOnRails
[03:53:51] sevenseacat: so there's a problem with your setup, because it applies to every single test
[03:54:38] fugee: can someone help me with the dustin fisher example for using acts_as_commentable_with_threading; the confusion for me is his comments_controller.rb doesn't have a new action https://github.com/DustinFisher/acts-as-commentable-with-threading-example
[03:54:39] sevenseacat: part of your setup is loading the test data in the fixtures folder into the test db
[03:54:46] Jason: so in my setup, should I create a user for testing and then desroy it after i'm done?
[03:54:55] sevenseacat: there might be a fixture for users that is invalid
[03:55:05] sevenseacat: do you have a test/fixtures/users.yml or something similar
[03:56:04] Jason: i do and it's mostly empty
[03:56:14] Jason: would you like me to paste it?
[03:56:50] Jason: sevenseacat: https://gist.github.com/jasonharrison/7005ca6c1ea42dd4cb8d6848ca34a3ce
[03:57:18] sevenseacat: yeah they don't look like they're going to create valid user records :)
[03:58:03] Jason: sevenseacat: let me play around with that and i'll be back in a few :)
[03:58:45] sevenseacat: at a minimum, your user record likely requires an email address and password to be valid
[03:59:09] sevenseacat: http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures might help
[03:59:09] Jason: i'm reading devise's docs on this and pulling some info from the schema
[03:59:16] Jason: already on it! :)
[03:59:41] sevenseacat: awesome sauce
[04:01:00] Jason: okay, fixtures in-play
[04:01:16] Jason: now it looks like i have to somehow log in to test
[04:03:18] sevenseacat: if you have to be authenticated when creating todos in the webapp, then yeah you'll have to authenticate in your tests before you can test the todos controller properly
[04:03:26] sevenseacat: devise can help you with that
[04:05:02] Jason: sevenseacat: aye, i'm looking at https://github.com/plataformatec/devise/wiki/How-To:-Test-with-Capybara
[04:05:36] Jason: but i am getting confused
[04:05:38] sevenseacat: thats for feature specs - they're a little different than the controller unit tests you currently havw
[04:05:46] Jason: that's what i suspected
[04:06:02] sevenseacat: feature specs are for actually testing the app via a web browser
[04:06:39] sevenseacat: https://github.com/plataformatec/devise#controller-tests
[04:07:05] sevenseacat: though it may have changed a little bit with rails 5 moving to integration tests instead of controller tests
[04:07:41] Jason: sevenseacat: right - i currently have `include Devise::TestHelpers`
[04:08:03] Jason: though i'm now getting this error: NoMethodError: undefined method `env' for nil:NilClass
[04:13:06] sevenseacat: yeah I think thats outdated
[04:13:39] sevenseacat: I think it should be `include Devise::Test::ControllerHelpers`
[04:13:49] sevenseacat: actually, `include Devise::Test::IntegrationHelpers` for integration tests
[04:14:02] xx00__: has joined #RubyOnRails
[04:15:56] Jason: sevenseacat: aha!
[04:16:08] Jason: sevenseacat: it looks like that worked, but my tests are failing for unrelated reasons
[04:16:13] Jason: i think i can take it from here
[04:16:16] Jason: thanks again
[04:25:14] ascarter: has joined #RubyOnRails
[04:25:21] quirkycoders: has joined #RubyOnRails
[04:34:59] Trynemjoel: has joined #RubyOnRails
[04:35:03] Jason: sevenseacat: success
[04:35:12] Jason: 7 runs, 9 assertions, 0 failures, 0 errors, 0 skips
[04:35:28] Jason: sevenseacat: so basically i was getting this super weird failure - ActiveRecord::RecordNotFound: Couldn't find Todo with 'id'=980190962 [WHERE "todos"."user_id" = ?]
[04:35:42] Jason: honestly the failure message was super unhelpful
[04:35:55] Jason: but i eventually thought that perhaps the post it's checking doesn't belong to the user
[04:36:15] Jason: setting the id: 1 attribute in users.yml made everything pass
[04:39:07] Coldblackice_: has joined #RubyOnRails
[04:43:53] Coldblackice_: has joined #RubyOnRails
[04:48:00] r3vDev: has joined #RubyOnRails
[04:54:29] Ropeney: has joined #RubyOnRails
[05:08:12] newcoder: has joined #RubyOnRails
[05:08:20] newcoder: I have ruby-2.1, is it enough to install rails-5?
[05:08:45] kruppm: has joined #RubyOnRails
[05:09:57] havenwood: newcoder: Nope.
[05:10:11] havenwood: newcoder: You'll need Ruby 2.2.2 or newer.
[05:10:22] havenwood: newcoder: Preferably Ruby 2.3.4 or Ruby 2.4.1.
[05:11:11] newcoder: Do you live in haven? Are you from haven?
[05:11:16] havenwood: newcoder: Check the last checknote of the Rails 5 release notes: http://guides.rubyonrails.org/5_0_release_notes.html
[05:11:24] havenwood: "Ruby 2.2.2+ required"
[05:13:41] havenwood: newcoder: https://github.com/rails/rails/blob/master/railties/lib/rails/ruby_version_check.rb#L5-L10
[05:14:52] newcoder: has left #RubyOnRails: ()
[05:16:52] crova: has joined #RubyOnRails
[05:24:02] xall: has joined #RubyOnRails
[05:30:47] crova: Greetings everyone. I have a controller where I generate KPIs to display on a dashboard. Those KPIs will be defined by Year, Month and Sender ID. Right now. Any thoughts on how to clean my code and do it in a clever and DRYer way?? https://gist.github.com/crova/445bbab05f077ca4592dc841d0ab4989
[05:34:16] Radar: That's a lot of code.
[05:34:58] crova: indeed, and what bugs me is that I repeat the same chunk of code for every month
[05:36:12] crova: so I'm pretty sure that I could do this on a better way, but what I tried so far have failed (I tried chaining scopes for example). Being quite new to rails, I thought I'd ask for some guidance on how to tackle this
[05:37:05] xall: has joined #RubyOnRails
[05:37:59] crova: and that's only for 2016 lol, I'll have the same bunch of lines by the end of this year :/
[05:38:48] havenwood: crova: You'll definitely want to extract method and DRY it up. I have a few threshold suggestions.
[05:39:33] crova: I'm all ears (and eyes) mate
[05:40:12] havenwood: crova: On the first line of uncommented code, you have `01` as an Integer. Change it to just `1` since it's not actually octal and the leading zero means that. For example: 08 #!> SyntaxError: (eval):2: Invalid octal digit
[05:40:48] havenwood: So if someone later changed that 01 to an 08 or 09 it'd break.
[05:40:58] sevenseacat: there is an 08 and 09 in there
[05:41:06] Technodrome: has joined #RubyOnRails
[05:41:06] sevenseacat: way way down the page
[05:41:24] crova: yes, for August and September
[05:41:40] havenwood: crova: Instead of `pluck('foo').sum` just use `sum('foo')`.
[05:41:49] Radar: ACTION cracks knuckles
[05:41:55] crova: I'll take note on that and change
[05:42:08] havenwood: Don't add 0.0 to convert to Float.
[05:42:13] havenwood: There's #to_f for that.
[05:42:29] havenwood: Also, consider why you need a Float and if it's appropriate.
[05:44:23] crova: since Cost, Margin and Turnover will often have decimals, I thought float would be the best format?!
[05:44:28] Radar: jan_opens_2016 = jan_o_2016 + 0.0
[05:44:30] Radar: I don't understand this.
[05:44:40] Radar: Oh I just read the scrollback. Rightio.
[05:44:58] havenwood: I've never seen that method of converting to Floats, I admit!
[05:46:59] crova: I wasn't aware of the #to_f you just mentioned, so I just figured that adding 0.0 I could force it to become one
[05:47:18] crova: but I'll update those
[05:55:27] krmela: has joined #RubyOnRails
[05:57:51] krmela: good day there i have question i am writing function which check for next work day from given date excluding as well free days from table i dont know where this days shall be it is model related or in controller ?
[05:58:27] havenwood: crova: You desperately need to extract methods.
[06:01:46] havenwood: krmela: What model would it go in? Does it apply to the data that model represents?
[06:02:04] Radar: crova: I can do it in about 1000 lines less: https://gist.github.com/radar/1e5ec86a594a9a1ad1b8baf0c606870c
[06:02:18] Radar: crova: The by_month method comes from my by_star gem: https://github.com/radar/by_star
[06:02:52] crova: havewood by "extract methods" you mean defining reusable classes? like def margin ... margin formula... end
[06:03:24] krmela: havenwood: well i have in model table locked days and trying write function which look for next bussiness day 1-5 excluding days specified in table locked days
[06:03:30] Radar: I know I'm missing all of this: https://gist.github.com/crova/445bbab05f077ca4592dc841d0ab4989#file-dashboard_controller-rb-L30-L56 but it was getting repetitive.
[06:04:19] Radar: In fact, this should all really be a method.
[06:04:42] crova: Radar that looks nice, way better than my mess
[06:05:15] crova: I don't quite understand the very first line tho, data = {}
[06:05:19] Radar: https://gist.github.com/radar/1e5ec86a594a9a1ad1b8baf0c606870c
[06:05:40] Radar: crova: If you don't understand that line then please please please read a Ruby book before you continue.
[06:06:34] crova: and I'll check the gem you mentioned
[06:06:43] crova: Radar any recommendation on which one?
[06:06:50] Radar: crova: The Well-Grounded Rubyist is good.
[06:07:34] krmela: crova: it is empty hash i think
[06:07:40] crova: I'll make sure I look for that one
[06:07:42] Jason: i'm playing around with rails and I made a todo scaffold with a user model with devise... i added has_many :todos in the user controller, and belongs_to :user in the todo controller
[06:07:59] Jason: it appears that in devise's user control panel, "delete my account" is not deleting the user's todos
[06:08:02] havenwood: crova: Grab the second edition, it's easier to follow along with modern Ruby.
[06:08:32] roshanavand: has joined #RubyOnRails
[06:08:51] krmela: Jason: you forgot to add to model , dependent: :destroy
[06:09:25] crova: krmela yes, I figured that out, I just don't quite see why he defines it, but I guess I have lots of reading to do lol
[06:09:47] crova: havenwood I appreciate the directions, you to Radar
[06:10:20] havenwood: crova: Here's a list of Ruby books: https://gist.github.com/baweaver/57a7c8296ca2c03effbd8fac1e7f6b40
[06:10:54] havenwood: crova: Reading the Well-Grounded Rubyist would help you a ton.
[06:11:32] crova: I'll definitely do it
[06:11:40] Jason: krmela: ahh
[06:12:10] crova: I've been doing everything by trial and error, but it seems that this is not too beneficial
[06:12:23] Jason: krmela: i'd add that in the user controller, yes? has_many :todos, dependent: :destroy ?
[06:13:03] Radar: Jason: in the user model
[06:13:10] havenwood: crova: Experimenting is valuable too. Just level up on the language between experiments! ;-)
[06:13:27] Jason: Radar: err, that's what i meant. yep. thank you!
[06:13:45] krmela: Jason: yes add that to user model
[06:13:53] Radar: crova: I think you should focus on collecting a single month's data in the shortest code you can (within reason)
[06:14:02] Jason: krmela: yep - thanks!
[06:14:18] Radar: crova: then look at what's going to change if you want to choose a different month, and then extract the code out to a method so that you can call the method with different arguments to change the months.
[06:14:48] crova: havenwood I bet it is, but as you can see, I'm missing a lot of the basics
[06:14:54] Radar: crova: I think you'll find this approach much easier.
[06:16:30] crova: Radar, I see what you mean, I'll also take a look on what you did to get some pointers
[06:20:09] conta: has joined #RubyOnRails
[06:30:21] sekmo: has joined #RubyOnRails
[06:31:58] ascarter: has joined #RubyOnRails
[06:35:02] Ropeney: has joined #RubyOnRails
[06:35:17] xall: has joined #RubyOnRails
[06:52:48] dminuoso: Radar: You remember the callback issues I mentioned wrt that external storage? Some form of UUID/GUID as an attribute attribute seems to be the best idea.
[06:53:02] DoubleMalt: has joined #RubyOnRails
[06:53:19] dminuoso: Migration turns out to be rather easy.
[06:53:20] krmela: havenwood: question where is best place to place bussiness day calculation in model or controller or another ?
[06:53:32] krmela: hello dminuoso
[06:54:16] dminuoso: krmela: Probably the model, but perhaps a service or the controller. Really hard to say without seeing the specific code.
[06:54:33] quirkycoders: has joined #RubyOnRails
[06:55:00] dminuoso: Radar: Wanna know a funny thing, this would have been actually a cool case to use Model.suppress for as a cool hack to avoid the real problem.
[06:55:29] krmela: dminuoso: it is two function they got date as param and looking for next bussness day excluding holidays from some table
[06:55:47] krmela: prev/ next bussiness day
[06:56:00] srinidhi: has joined #RubyOnRails
[06:56:04] sevenseacat: dminuoso: you take that back
[06:56:19] dminuoso: sevenseacat: ? :o
[06:57:13] sevenseacat: no 'cool hacks' plz
[06:57:36] dminuoso: Then consider it a warm and comfy hack.
[06:57:46] dminuoso: Something you can cuddle with,.
[07:06:09] krmela: well first try of date looking function https://pastebin.com/rX1u8heN can anyone give me suggest on that ?
[07:12:48] dionysus69: has joined #RubyOnRails
[07:13:23] Radar: dminuoso: Glad you were able to figure it out :)
[07:13:29] Radar: dminuoso: lol @ model.suppress though
[07:15:24] dminuoso: Radar: Im just trying desperately to find a use case for it.. :D
[07:15:55] NeutronStarr: has joined #RubyOnRails
[07:16:16] pwnd_nsfw: has joined #RubyOnRails
[07:16:58] Radar: dminuoso: I bet DHH is too
[07:17:08] pwnd_nsfw: "Pundit::PolicyScopingNotPerformedError:"
[07:17:13] Radar: Actually no he probably has That One Place in Basecamp that needs it so Every Rails App Ever needs it.
[07:17:15] Radar: pwnd_nsfw: no u
[07:17:25] dminuoso: Radar: Wait hey. Are you talking about Turbolinks?
[07:17:27] pwnd_nsfw: I'm even referencing R4IA
[07:17:31] Radar: dminuoso: lawl
[07:17:53] pwnd_nsfw: essentially mimicking the code
[07:20:19] pwnd_nsfw: alright, time to cave
[07:28:18] ferr: has joined #RubyOnRails
[07:28:56] pwnd_nsfw: https://gist.github.com/SirUncleCid/04c2a856f997d8841232efd65ca0fc5b
[07:29:29] pwnd_nsfw: tried to figure out WHY it'd say not performed, 'cause I thought it counted when you kipped in an action
[07:30:26] sevenseacat: scoping is only for the index action
[07:30:38] sevenseacat: you're calling the verification for all actions
[07:31:15] pwnd_nsfw: renote: total of maybe 10 hours of sleep over the last 5 days
[07:31:20] pwnd_nsfw: Ok, maybe 11
[07:31:23] sevenseacat: get some sleep, dood
[07:31:52] pwnd_nsfw: When I'm dead, which will be soon if I keep this up
[07:32:21] pwnd_nsfw: After these tests are green
[07:34:06] pwnd_nsfw: But I have no index actions yet
[07:35:41] pwnd_nsfw: watch it be the login_as
[07:35:48] pwnd_nsfw: 'cause blog posts are there
[07:36:02] pwnd_nsfw: lol, I have no idea
[07:39:25] ascarter: has joined #RubyOnRails
[07:44:42] dionysus69: has joined #RubyOnRails
[07:46:53] pwnd_nsfw: yeah, gonna go to bed and bang my head against the desk tomorrow
[07:47:23] pwnd_nsfw: https://gist.github.com/SirUncleCid/a19144b2eb9c421fce2a05a344e3b0ef
[07:54:56] marr: has joined #RubyOnRails
[07:56:35] workerbeetwo: has joined #RubyOnRails
[07:57:10] workerbeetwo: Hi. What doas & mean in a call "object&.name" ?
[07:59:25] pwnd_nsfw: workerbeetwo, http://mitrev.net/ruby/2015/11/13/the-operator-in-ruby/
[07:59:32] mikecmpbll: has joined #RubyOnRails
[08:03:45] Jameser: has joined #RubyOnRails
[08:06:08] dminuoso: workerbeetwo: It means we have no proper support for monads.
[08:35:13] srinidhi: has joined #RubyOnRails
[08:36:00] Doldge: has joined #RubyOnRails
[08:38:56] arBmind: has joined #RubyOnRails
[08:38:56] dminuoso: Wait. I do not need to interact with people anymore, we have bots for that.
[08:38:57] helpa: rapha: hi
[08:39:05] DoubleMalt: has joined #RubyOnRails
[08:44:43] rapha: I get an Encoding::UndefinedConversionError "from ASCII-8BIT to UTF-8" in https://github.com/rails/rails/blob/4a4286acc3047363d5dfaee58cd71a47b3991575/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb#L33 ... how do I debug what's going wrong there? (I'm trying to save a JPEG file to a BLOB)
[08:45:38] rapha: dminuoso: But now you have to interact with the bot!
[08:45:50] dminuoso: rapha: !undefinedconversion
[08:45:55] dminuoso: Damn. Looks we dont have any such factoid.
[08:46:12] dminuoso: rapha: Why do you think you can force an arbitrary binary string into an UTF 8 string?
[08:46:19] dminuoso: Give me an honest answer.
[08:46:35] ascarter: has joined #RubyOnRails
[08:48:31] rapha: dminuoso: Ur, I didn't think I could do that. I didn't even think AR would try to do that for a field that is of type BLOB.
[08:48:41] dminuoso: rapha: And yet you are trying to do just that.
[08:49:09] rapha: dminuoso: in my model it just says "self.binary_data = File.binread(tempfile)
[08:49:40] dminuoso: rapha: It would appear that the sqlite adapter has no support for binary strings.
[08:49:50] rapha: dminuoso: let me investigate.
[08:50:39] dminuoso: rapha: What type did you use in your migration?
[08:51:49] rapha: dminuoso: Indeed, in my brain I had saved type "binary" but in the migration file I now see it says type "string". Which would explain a lot. I need to find coffee before doing work in the morning.
[08:52:58] rapha: Hahaaaaah! As soon as you do it right, it starts working! It's amazing! :-)
[08:53:04] krmela: hello there i am trying make function which check if it is work days and date is not in locked days just maybe anyone knows what is wrong on line 3 https://pastebin.com/s21kaL4t
[08:53:12] rapha: Thank you dminuoso. I'll head off to buy that coffee now and to catch the train.
[08:53:53] dminuoso: krmela: !wrong
[08:53:53] helpa: krmela: Let me put it this way: the HELPA 9000 series is the most reliable computer ever made. No HELPA computer has ever made a mistake or distorted information. We are all, by any practical definition of the words, foolproof and incapable of error.
[08:54:01] dminuoso: Again.. not helpful.
[08:54:21] dminuoso: krmela: !didntwork
[08:54:21] helpa: krmela: What "didn't work"? Did your server not start? Did your computer explode? Did your webpage turn bright pink? Did your client not pay your bill on time? You may have to be more specific. A Gist (http://gist.github.com) of the code that doesn't work (and the error you are getting) will be helpful.
[08:55:43] dminuoso: krmela: Not only is your gist incomplete (you did not even gist until the end of the function), but it also does not show how it is used. What kind of types date or inc are.
[08:57:14] krmela: dminuoso: sorry my mistake i am make another pastebin with whole class
[09:01:22] krmela: well here is https://pastebin.com/bkMjvnBp i am dealing with looking next working day /previous
[09:02:40] lxsameer: has joined #RubyOnRails
[09:05:11] dminuoso: Still not telling me how this is used.
[09:05:17] dminuoso: And also still not telling me what problem you have.
[09:05:31] dminuoso: You have managed to waste my time twice, going to do productive things.
[09:07:09] krmela: well i am in that looking for next business day and check if is that day holiday then date increases , but it failed with current date
[09:07:30] dminuoso: I did not ask what it does, I asked how it is used.
[09:07:42] dminuoso: ACTION goes back to work
[09:08:28] krmela: well i am trying look for next/previous bussines day in calendar sorry
[09:14:03] mr-spoon: has joined #RubyOnRails
[09:26:22] ferr: has joined #RubyOnRails
[09:36:17] umaaji: has joined #RubyOnRails
[09:38:04] dionysus69: has joined #RubyOnRails
[09:49:52] rfoust: has joined #RubyOnRails
[10:02:35] conta: has joined #RubyOnRails
[10:10:14] rikkipitt: has joined #RubyOnRails
[10:14:08] fox_mulder_cp: has joined #RubyOnRails
[10:24:51] DoubleMalt: has joined #RubyOnRails
[10:29:36] Fernando-Basso: has joined #RubyOnRails
[10:48:29] ur5us: has joined #RubyOnRails
[10:51:25] ascarter: has joined #RubyOnRails
[11:10:41] arBmind: has joined #RubyOnRails
[11:14:21] DrYockel: has joined #RubyOnRails
[11:18:23] DoubleMalt: has joined #RubyOnRails
[11:19:05] AzaToth: has joined #RubyOnRails
[11:20:52] renegadeandy: has joined #RubyOnRails
[11:21:23] renegadeandy: fryguy: sorry I missed you last night. This was the question i was referring to : https://stackoverflow.com/questions/44740612/in-a-included-partial-how-do-you-render-the-original-page-with-validation-errors/44741603#44741603
[11:28:35] codelahoma: has joined #RubyOnRails
[11:30:49] fugee: can someone help me with the dustin fisher example for using acts_as_commentable_with_threading; the confusion for me is his comments_controller.rb doesn't have a new action https://github.com/DustinFisher/acts-as-commentable-with-threading-example I wanna know why his comments controller has no "new" action
[11:31:53] apparition: has joined #RubyOnRails
[11:43:20] quirkycoders: has joined #RubyOnRails
[11:48:38] ur5us: has joined #RubyOnRails
[11:56:35] ascarter: has joined #RubyOnRails
[11:56:45] fugee: has left #RubyOnRails: ("Leaving")
[11:58:48] crote: has joined #RubyOnRails
[12:00:09] ur5us: has joined #RubyOnRails
[12:01:40] crote: Simple question but i'm having a hard time googling it: how do i make a (controller) method available in the layout, without making it available in all other views?
[12:04:42] shotbug: has joined #RubyOnRails
[12:19:15] quirkycoders: has joined #RubyOnRails
[12:19:53] krmela: has joined #RubyOnRails
[12:20:08] dminuoso: Crote: You dont.
[12:20:35] dminuoso: Crote: Trying to call a controller method from a view is about the equivalent of your 9 year old kid asking for the keys of your car.
[12:20:51] dminuoso: You say "Screw you. No."
[12:21:16] helpa: Crote: It seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[12:24:43] tbuehlmann: dminuoso: like current_user, better not have that!
[12:25:00] dminuoso: tbuehlmann: Don't get me started on that.
[12:25:27] crote: dminuoso: or a helper method, for that matter. I have a piece of code which generates a data structure used in the view, but it is too complex to embed in the view. At the moment it is in ApplicationHelper, but I don't really want it to be available in every single view because it is not generic _at all_.
[12:25:44] dminuoso: Crote: Is there a specific reason why this should be in your controller?
[12:27:15] tbuehlmann: dminuoso: sorry, meant to write Current.user
[12:28:21] dminuoso: Crote: You could either use helper_method as detailed here: http://api.rubyonrails.org/classes/AbstractController/Helpers/ClassMethods.html#method-i-helper_method --> or you could use the pre-defined mechanism and pass a callable object to the view instaead.
[12:29:09] dminuoso: I would probably prefer the second.
[12:29:16] Jameser: has joined #RubyOnRails
[12:29:21] crote: but wouldn't it then still be available to the entire view? I only want it to be available to layouts/application_helper.html.erb.
[12:29:34] dminuoso: Crote: Oh. Mmm.
[12:30:32] tweeeaks: has joined #RubyOnRails
[12:30:33] crote: It's not a huge deal, but at the moment i have a method in ApplicationHelper with a big fat "only use me in the layout" comment, which is a bit weird...
[12:30:57] crote: considering the rest of the methods there are generic for the whole application.
[12:30:57] dminuoso: Crote: Is this a multi-user project?
[12:31:05] dminuoso: *multi-developer
[12:33:49] DoubleMalt: has joined #RubyOnRails
[12:35:09] dminuoso: Crote: What you _could_ do is use if !Rails.env.production? assertion that simply checks if "layouts/application_helper.html.erb" is in Kernel#caller.
[12:35:19] dminuoso: I can't think of any other solution.
[12:35:29] Jameser: has joined #RubyOnRails
[12:36:05] crote: why check the env?
[12:36:37] kruppm: has joined #RubyOnRails
[12:36:50] dminuoso: Crote: You probably don't want any such checks to be done on production, they would trigger for every single request.
[12:37:31] crote: dminuoso: I guess that would work. Not sure if it's an improvement, though...
[12:37:55] dminuoso: Crote: It wouldn't just be documentative. If that raises, it will block your tests.
[12:38:10] dminuoso: Which means it wont pass your pipeline, which means it won't get merged.
[12:38:57] dminuoso: Crote: The question is: Shouldn't they use it, or mustn't they use it?
[12:40:41] dminuoso: If it's a "shouldn't", then a comment will suffice. If they mustn't, a test should somehow catch this. The assertion would be a simple way without adding a before to each and every single test that stubs the function.
[12:43:11] crote: dminuoso: it would not break anything, but there is no valid use case so it would be weird to have it exposed.
[12:43:19] arup_r: has joined #RubyOnRails
[12:43:26] crote: basically, if you use it in any other way, you're doing it wrong.
[12:44:05] dminuoso: Crote: What you could do, is not put it in a helper to begin with.
[12:44:47] dminuoso: Crote: You could place this into a concern, expose it with helper_method and make sure that this file is placed specially so that nobody will just "accidentally stumble over it looking for utility stuff"
[12:45:55] dminuoso: Crote: Though then again, the only way someone would use this is if they see it. In which case a big comment should be enough.
[12:47:16] dminuoso: I mean if someone purposefully ignores a big comment "XXX DO NOT USE FOR VIEWS" they deserve to be shot.
[12:48:04] arBmind: has joined #RubyOnRails
[12:48:32] Technodrome: has joined #RubyOnRails
[12:48:52] samsquanch: has joined #RubyOnRails
[12:50:58] crote: dminuoso: hence my dilemma. but if there isn't some helper_method-like `layout_helper_method`, I'm probably going to leave it as-is: with a big fat warning.
[12:51:08] dminuoso: Crote: There is.. however..
[12:51:26] dminuoso: Crote: helper_method in your ApplicationController effectively turns it global again...
[12:51:48] dminuoso: If only Ruby had something like C++ `private' :-P
[12:58:41] workmad3: has joined #RubyOnRails
[12:59:48] lxsameer: has joined #RubyOnRails
[13:02:35] ascarter: has joined #RubyOnRails
[13:11:06] dionysus69: has joined #RubyOnRails
[13:11:58] quirkycoders: has joined #RubyOnRails
[13:12:03] r3vDev: has joined #RubyOnRails
[13:12:33] wethu: has joined #RubyOnRails
[13:14:09] arup_r: inside the bin/setup file, how can I call another bash script? I have so far this https://gist.github.com/aruprakshit/c4d546346999cf79bb103dd74e4216b4
[13:14:11] kruppm: is there a way to split up routes.rb without the ugly `eval(File.read...)` i see everywhere? specifically: https://goo.gl/CTcjrP
[13:14:36] kruppm: first example shows what I'm trying to do, 2nd and 3rd show my approach to implement... but it does not work :)
[13:15:17] kruppm: but I have to say, i'm not very familiar with stuff like instance_eval in ruby
[13:17:35] Technodrome: has joined #RubyOnRails
[13:18:07] dminuoso: kruppm: Yes.
[13:19:31] kruppm: dminuoso: would you be so kind and give me a hint? :)
[13:19:44] dminuoso: kruppm: I have to come up with how to do that first.
[13:19:51] dminuoso: kruppm: But it should be fairly trivial.
[13:19:54] dminuoso: Give me a moment.
[13:20:33] NoGodDamnIdea: has joined #RubyOnRails
[13:24:18] kruppm: nevermind... instance_eval(&block) works. what's the difference to instance_eval { block.call } here? just for clarity?
[13:26:15] DoubleMalt: has joined #RubyOnRails
[13:26:29] dminuoso: kruppm: An additional context frame.
[13:26:46] shilon: has joined #RubyOnRails
[13:26:54] dminuoso: kruppm: I havent responded yet because I think I have stumbled over an interesting Ruby bug.
[13:27:37] kruppm: ya, but shouldn't the context be the same for &block? or does block.call use the original context?
[13:27:52] dminuoso: kruppm: No. And no.
[13:28:35] kruppm: alright, now i'm confused :) mind giving me a hint on where to read about stuff like this?
[13:28:48] chimkan: has joined #RubyOnRails
[13:28:51] chimkan: has left #RubyOnRails: ()
[13:29:06] dminuoso: kruppm: Ruby does not "bind" blocks to the execution environment when you define them.
[13:29:24] futilegames: has joined #RubyOnRails
[13:29:28] dminuoso: kruppm: Instead it's a rather dynamic thing.
[13:29:35] patarr: has joined #RubyOnRails
[13:29:35] dminuoso: (Which is why stuff like instance_eval works in the first place)
[13:30:23] chimkan: has joined #RubyOnRails
[13:30:44] arup_r: nvm I figured out. :)
[13:31:00] dminuoso: kruppm: Semantically instance_eval sets "self", the default definee, and the variable contexts for a given block. But only that particular block.
[13:32:25] dminuoso: kruppm: Let me rename the inner executable ("block" is a horrible name) and point out the difference:
[13:32:39] kruppm: oh, so block.call still uses the other reference, even though it is called inside a block with "self" correctly set. correct? :)
[13:32:44] dminuoso: instance_eval { executable.call } # here instance_eval sets the execution context for the outer block, not not "executable" itself.
[13:33:09] dminuoso: `instance_eval { executable.call }` is effectively the same as `executable.call`
[13:33:15] dminuoso: There's virtually no difference.
[13:33:29] kruppm: ye, got that now. Thank You very much!
[13:33:45] shotbug: has joined #RubyOnRails
[13:33:58] dminuoso: kruppm: I was actually trying to show an example using procs, but it seems there's a bug in Ruby.
[13:36:26] dminuoso: kruppm: https://eval.in/822469
[13:38:42] Cork: anyone know how to add a content-type for a assets file type?
[13:39:29] dminuoso: Cork: Rails just uses Mime::Type
[13:39:49] Cork: you mean Mime::Type.register?
[13:39:50] dminuoso: http://api.rubyonrails.org/classes/Mime/Type.html#method-c-register
[13:39:59] kruppm: dminuoso: thank you for the example :)
[13:39:59] Cork: that is for respond_to not files
[13:40:18] Cork: i want to add a Content-Type header for .woff2 files
[13:40:40] dminuoso: Mmmm interesting.
[13:40:57] dminuoso: Cork: I guess this is for when you serve asset with rails?
[13:41:16] Cork: or if you use the asset pipeline
[13:41:30] Cork: the mimetype from nginx isn't used in those cases
[13:41:53] Cork: i've tried adding the file type to Rack::Mime::MIME_TYPES but it doesn't help either
[13:42:06] dminuoso: Cork: This should happen in the correct preprocessor
[13:43:14] dminuoso: Cork: Is this your own sprockets preprocessor?
[13:43:23] dminuoso: Oh wait. Hah.
[13:43:28] dminuoso: You are missing the preprocessor to begin with.
[13:43:57] dminuoso: Cork: http://edgeguides.rubyonrails.org/asset_pipeline.html#making-your-library-or-gem-a-pre-processor
[13:44:37] Cork: i don't follow...
[13:44:55] Cork: i do get content-type headers just not for this file type
[13:45:09] xx00__: has joined #RubyOnRails
[13:46:26] dminuoso: Cork: If you want your assets pipeline to handle a particular file specially, you need to extend sprockets somehow.
[13:46:56] Cork: dminuoso: i don't want to handle it specifically i want it to handle it just like it handle .woff, or .eot or .ttf
[13:47:14] Cork: meaning sending a content-type: application/font-woff and so on
[13:47:48] mikecmpbll: how would you suggest I run a ruby script with `rails runner`, that depends on other gems that aren't in my rails project's Gemfile?
[13:47:49] Cork: currently .eot, .ttf and .woff gets content-type
[13:47:56] Cork: while .woff2 gets no content-type header at all
[13:48:00] mikecmpbll: the script is in a directory with a Gemfile
[13:48:32] apparition: has joined #RubyOnRails
[13:48:32] Cork: mikecmpbll: i would recommend just including those gem files in the rails projects Gemfile
[13:48:41] mikecmpbll: not really practical :'(
[13:48:47] Cork: why not?
[13:49:00] dminuoso: mikecmpbll: use groups
[13:49:04] dminuoso: mikecmpbll: Put them into a special group.
[13:49:10] mikecmpbll: because that will involve deploying and bundling etc in production, and this needs to be flexible
[13:49:21] dminuoso: mikecmpbll: I do not see a way to use multiple Gemfiles at the same time, Bundler was never designed for this.
[13:49:25] dminuoso: mikecmpbll: No it would not.
[13:49:31] dminuoso: mikecmpbll: Just use a special gem group.
[13:49:39] dminuoso: like :stupid_stuff
[13:49:46] dminuoso: Or :i_smell_funny
[13:49:48] mikecmpbll: dminuoso : can you explain how that helps
[13:50:07] dminuoso: mikecmpbll: It lets you specify the dependencies as part of the bundle, but allow you to not install them everywhere.
[13:52:00] smoitra: has joined #RubyOnRails
[13:53:28] quirkycoders: has joined #RubyOnRails
[13:56:30] mikecmpbll: not really what i'm after though. i'm surprised it's not simple to load additional gems
[13:56:36] chouhoulis: has joined #RubyOnRails
[14:00:59] my123: has joined #RubyOnRails
[14:05:29] ascarter: has joined #RubyOnRails
[14:06:50] Technodrome: has joined #RubyOnRails
[14:08:35] rfoust: has joined #RubyOnRails
[14:09:01] jphase: has joined #RubyOnRails
[14:11:27] Rodya_: has joined #RubyOnRails
[14:17:03] rfoust: has joined #RubyOnRails
[14:22:47] crova: has joined #RubyOnRails
[14:22:54] rfoust: has joined #RubyOnRails
[14:25:17] arup_r: has joined #RubyOnRails
[14:27:34] dionysus69: has joined #RubyOnRails
[14:28:59] rfoust: has joined #RubyOnRails
[14:32:50] dionysus69: has joined #RubyOnRails
[14:37:07] GodFather: has joined #RubyOnRails
[14:43:02] catphish: has joined #RubyOnRails
[14:44:30] rfoust: has joined #RubyOnRails
[14:44:58] dionysus69: has joined #RubyOnRails
[14:48:11] ResidentBiscuit: has joined #RubyOnRails
[14:48:38] ResidentBiscuit: has joined #RubyOnRails
[14:50:45] cam27: has joined #RubyOnRails
[14:54:04] theunraveler: has joined #RubyOnRails
[14:58:44] cjohnson: How can I write one validator that uses 2 other validators?
[14:59:07] cjohnson: Namely I need to write a StateOrZipValidator that loads my existing StateValidator and ZipValidator and uses them both
[15:02:22] rfoust: has joined #RubyOnRails
[15:03:09] jhfisc: has joined #RubyOnRails
[15:09:13] [Butch]: has joined #RubyOnRails
[15:11:20] ascarter: has joined #RubyOnRails
[15:20:55] shotbug: has joined #RubyOnRails
[15:23:51] GodFather: has joined #RubyOnRails
[15:26:21] rfoust: has joined #RubyOnRails
[15:28:20] jhfisc: has joined #RubyOnRails
[15:28:28] irishfromua: has joined #RubyOnRails
[15:29:30] dionysus69: has joined #RubyOnRails
[15:29:52] patarr: Hi. I've created a model in my application that has a super class with a custom `establish_connection` call to leverage a separate database. The problem I'm finding is that my Specs don't seem to be rolling back when they're complete or error'd out.
[15:29:56] patarr: How can I solve this?
[15:30:52] matthewd: patarr: Rails version?
[15:31:04] catphish: has left #RubyOnRails: ("Leaving")
[15:31:30] patarr: matthewd: matthewd 5.0.1
[15:31:49] rfoust: has joined #RubyOnRails
[15:32:45] jhfisc: has joined #RubyOnRails
[15:33:05] matthewd: patarr: Something involving DatabaseCleaner is probably your best option, then
[15:35:19] cpruitt: has joined #RubyOnRails
[15:38:35] jhfisc: has joined #RubyOnRails
[15:39:52] patarr: matthewd: is this not a feature already of rspec?
[15:43:16] matthewd: Not with multiple databases in Rails < 5.1, no
[15:44:25] cam27: What would be a good book that works solely with Active Record?
[15:44:57] Technodrome: has joined #RubyOnRails
[15:45:59] patarr: I'm also getting an error of NoMethodError: undefined method `use_transactional_fixtures='
[15:48:40] jhfisc: has joined #RubyOnRails
[15:48:50] cam27: Just about done with the RSPec book, I know it is dated, but still got a lot out of it. So it sounds like Webrat has been superceded by Capybara. So can I use Cucumber, RSpec, and Capybara? does that make sense?
[15:50:10] tbuehlmann: cam27: sounds okay to me
[15:52:14] cam27: Do most Rails developers develop like this and with the simulated browser? Cause that’s where these books I’m reading seem to be going to speed up the process.
[15:53:10] tbuehlmann: do you mean integration tests (/feature specs)?
[15:54:13] cam27: I really mean the whole application, from the outside in
[15:54:37] tbuehlmann: can't speak for other developers, but that's what I do at least. rails suggests doing so, too, since controller tests are gone, integration tests taking over completely
[15:56:02] cam27: I read the RSpec book in one week, and am going to go back to the Rails, Angular, Postgres, Bootstrap one. Try to finish that one this week too. while I look for jobs
[15:56:39] gil_: has joined #RubyOnRails
[15:57:06] brent__: has joined #RubyOnRails
[15:57:49] elcontrastador: has joined #RubyOnRails
[15:57:52] patarr: matthewd: I gave this a shot to no avail https://stackoverflow.com/a/14197798
[15:58:29] patarr: It now is doing information schema queries on my second database connection for all the models present on the main connection, and I'm also getting undefined method `connection_pool' for #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x007fcee5fafe68>
[15:58:49] patarr: matthewd: do you have any resources on how rails >5.1 handles multi db conns?
[15:58:57] cam27: The material I’m trying to find to read though would be working with Databases in more depth, and service layers
[15:59:22] aajjbb: has joined #RubyOnRails
[16:00:38] jhfisc: has joined #RubyOnRails
[16:01:21] Rodya_: has joined #RubyOnRails
[16:01:32] matthewd: patarr: It isn't yet public API, so it's not properly documented.. but see https://github.com/rails/rails/pull/24844 & https://github.com/rails/rails/pull/24965
[16:03:22] rietta: has joined #RubyOnRails
[16:04:17] shotbug: has joined #RubyOnRails
[16:06:19] matthewd: Actually, now I'm not sure.. maybe 5.0 did already handle transactions for multiple connections? :/
[16:06:42] patarr: I solved my issue with a rails eager_load! in my spec/rails_helper
[16:07:41] troys: has joined #RubyOnRails
[16:10:25] cam27: So rails has eager and lazy loading then too
[16:11:25] jhfisc: has joined #RubyOnRails
[16:16:06] ascarter: has joined #RubyOnRails
[16:16:08] tbuehlmann: cam27: right
[16:19:12] chouhoulis: has joined #RubyOnRails
[16:20:25] jhfisc: has joined #RubyOnRails
[16:22:16] dionysus69: has joined #RubyOnRails
[16:31:14] gusrub: has joined #RubyOnRails
[16:31:51] conta1: has joined #RubyOnRails
[16:36:46] jhfisc: has joined #RubyOnRails
[16:46:51] jhfisc: has joined #RubyOnRails
[16:48:43] gusrub: has joined #RubyOnRails
[16:49:00] dionysus69: has joined #RubyOnRails
[16:50:45] dionysus69: has joined #RubyOnRails
[16:51:53] jhfisc: has joined #RubyOnRails
[16:53:45] xco: hi. maybe someone knows why i’m getting TypeError: can't quote Array on @user.tagging_sessions.where('started_at between ? and ?', start_at_param, end_at_param)
[16:54:07] xco: start_at_param looks like this <ActionController::Parameters {"year"=>"2016"} permitted: false>
[16:54:27] xco: before someone asks, yes, i’m coming from Google
[16:56:40] S1kx: has joined #RubyOnRails
[16:57:27] jhfisc: has joined #RubyOnRails
[16:57:37] S1kx: has joined #RubyOnRails
[16:58:23] dionysus69: has joined #RubyOnRails
[16:58:49] S1kx: has joined #RubyOnRails
[17:01:42] jhfisc: has joined #RubyOnRails
[17:01:49] patarr1: has joined #RubyOnRails
[17:02:31] dionysus69: has joined #RubyOnRails
[17:06:45] jphase: has joined #RubyOnRails
[17:07:15] jhfisc: has joined #RubyOnRails
[17:11:48] lbrewington: has joined #RubyOnRails
[17:12:03] jphase: has joined #RubyOnRails
[17:12:13] jhfisc: has joined #RubyOnRails
[17:12:43] lbrewington: i am trying to use byebug with "bin/rails s" but it keeps giving me the error "ArgumentError (wrong number of arguments (given 0, expected 2)):" no matter where I try to place byebug into the code
[17:18:07] Tempesta: has joined #RubyOnRails
[17:19:07] jhfisc: has joined #RubyOnRails
[17:19:42] dionysus69: has joined #RubyOnRails
[17:21:49] dionysus69: has joined #RubyOnRails
[17:25:23] jhfisc: has joined #RubyOnRails
[17:25:28] patarr: has joined #RubyOnRails
[17:26:24] lbrewington: is this the official IRC channel?
[17:30:48] helpa: https://github.com/pry/pry and https://github.com/pry for its ecosystem
[17:30:57] baweaver: That'll help.
[17:31:00] baweaver: Pry uses byebug
[17:31:07] baweaver: and yes it's the official channel
[17:31:27] baweaver: we even had it blessed by Father David and Saint matthewd
[17:32:07] lbrewington: there is so much misinfomration about rails on theinternet
[17:32:13] lbrewington: it is mind boggling
[17:33:05] baweaver: there is so much misinformation on the internet # ftfy
[17:33:13] baweaver: what specifically
[17:34:23] lbrewington: mri, rvm, rbenv, binutils, pry, byebug, etc etc etc
[17:34:40] lbrewington: i guess verison churn is a "feature" of rails
[17:36:43] dionysus69: has joined #RubyOnRails
[17:38:12] gusrub: has joined #RubyOnRails
[17:39:56] baweaver: So is there a question, or are we venting now?
[17:40:52] baweaver: because truth be told you're likely going to find the same types of fun issues in any language or framework. Stockholme syndrome takes care of the rest for the framework/language you think doesn't have that issue.
[17:41:08] gusrub_: has joined #RubyOnRails
[17:41:58] dionysus69: has joined #RubyOnRails
[17:43:15] baweaver: In the mean time we can help, but that requires there to be some degree of specificity of grievance or just straight up questions.
[17:45:48] renegadeandy: hey all - can somebody help out with this question : https://stackoverflow.com/questions/44740612/in-a-included-partial-how-do-you-render-the-original-page-with-validation-errors/44741603#44741603
[17:45:53] renegadeandy: nobody seems to be able to provide an answer
[17:48:51] SteenJobs: has joined #RubyOnRails
[17:49:35] patarr: has joined #RubyOnRails
[17:50:02] baweaver: Start with what works then see what you can find to simplify.
[17:50:04] Andr3as: cant you just render :show?
[17:50:11] baweaver: As far as the simplify part, looking.
[17:50:27] renegadeandy: Andr3as: you talking about my question?
[17:50:38] Andr3as: i try, at least ;)
[17:51:01] k1t: has joined #RubyOnRails
[17:51:53] Andr3as: ah, got it, so, when the journey was saved but there was an issue with a leg, then you want to render the journey's show page
[17:52:10] renegadeandy: Andr3as: well sure, i could do render "journeys/show" however, it doesn't seem to bring the validation errors onto the rendered partial.
[17:52:14] renegadeandy: As i mention in my question
[17:52:16] Andr3as: but if there's an issue with the journey as well, you need the journey's new page
[17:53:17] dionysus69: has joined #RubyOnRails
[17:53:53] renegadeandy: there isn't an issue with the journey Andr3as
[17:54:18] renegadeandy: Journey show page doesn't make any alterations to the journey, it just adds a leg to the journey
[17:54:54] k1t: is it weird if i have a route like ':date/availability_slots' for my GET request, since I only need these availability slots for a given date
[17:55:04] k1t: for the index action,
[17:55:34] k1t: so, exclude the index action from regular resource routes, then create this one in its place... 0,o
[17:56:07] weathermaker: has joined #RubyOnRails
[17:56:35] renegadeandy: k1t: i think thats absolutely fine :)
[17:57:06] k1t: ty @renegadeandy
[17:57:12] k1t: renegadeandy: *
[17:57:27] dionysus69: has joined #RubyOnRails
[17:57:27] k1t: damn slack shortcuts haha
[17:57:30] xall: has joined #RubyOnRails
[17:58:06] gusrub: has joined #RubyOnRails
[18:00:10] wiki-ruby-1: has joined #RubyOnRails
[18:01:54] gusrub: has joined #RubyOnRails
[18:02:37] et09: has joined #RubyOnRails
[18:02:55] et09: i wanna make sure i have this right - rails g migration [...] user:references, this will add a foreign key constraint - and this - rails g migration [...] user:belongs_to - this won't?
[18:04:40] Andr3as: renegadeandy: do you show the errors on your "show-page"? i cant find it in your snippet...
[18:06:46] lbrewington: baweaver: yes, you are correct. it mostly just me be frustrated, but thanks for taking the time to reply.
[18:09:43] roshanavand: has joined #RubyOnRails
[18:12:03] wiki-ruby-1: has joined #RubyOnRails
[18:13:24] wiki-ruby-1: Hi good ppl. I was curious if anyone had anytype of advice for me related to setting up a great GOTO default stack interms of AUTOMATED teststing... Which can handle most or act as a sort of default testing stack ty
[18:19:08] patarr: has joined #RubyOnRails
[18:19:42] tbuehlmann: et09: belongs_to is an alias for references, they do the same
[18:23:48] jhfisc: has joined #RubyOnRails
[18:25:39] sonOfRa: has joined #RubyOnRails
[18:34:05] jhfisc: has joined #RubyOnRails
[18:34:28] patarr: has joined #RubyOnRails
[18:39:41] jhfisc: has joined #RubyOnRails
[18:40:05] AntiSpamMeta: has joined #RubyOnRails
[18:43:26] mr-spoon: has joined #RubyOnRails
[18:45:54] jhfisc: has joined #RubyOnRails
[18:48:14] patarr: has joined #RubyOnRails
[18:48:29] SteenJobs: has joined #RubyOnRails
[18:48:47] dionysus69: has joined #RubyOnRails
[18:49:42] jhfisc: has joined #RubyOnRails
[18:53:30] dionysus69: has joined #RubyOnRails
[18:54:43] pwnd_nsfw: https://gist.github.com/SirUncleCid/04c2a856f997d8841232efd65ca0fc5b
[18:54:55] pwnd_nsfw: Still unable to figure out why it's caring about policy scoping...
[18:55:37] jhfisc: has joined #RubyOnRails
[18:56:28] mr-spoon: has joined #RubyOnRails
[18:57:52] mikecmpbll: has joined #RubyOnRails
[18:59:40] SteenJobs: has joined #RubyOnRails
[19:00:31] hahuang65: has joined #RubyOnRails
[19:00:42] qguv: has left #RubyOnRails: ("WeeChat 1.8")
[19:01:41] jhfisc: has joined #RubyOnRails
[19:04:51] gusrub: has joined #RubyOnRails
[19:05:23] chouhoulis: has joined #RubyOnRails
[19:09:55] SteenJobs: has joined #RubyOnRails
[19:09:57] jhfisc: has joined #RubyOnRails
[19:13:28] Fernando-Basso: has joined #RubyOnRails
[19:14:04] shilon: has left #RubyOnRails: ()
[19:15:41] jhfisc: has joined #RubyOnRails
[19:18:20] jhfisc: has joined #RubyOnRails
[19:20:36] arup_r: has joined #RubyOnRails
[19:25:41] jhfisc: has joined #RubyOnRails
[19:37:06] srinidhi: has joined #RubyOnRails
[19:38:23] gambl0re: has joined #RubyOnRails
[19:39:10] renegadeandy: Andr3as: I am talking about form validation errors which automatically get added to the form elements via simple_gem
[19:40:21] Rodya_: has joined #RubyOnRails
[19:40:45] hahuang65: has joined #RubyOnRails
[19:40:59] renegadeandy: please help me : https://stackoverflow.com/questions/44740612/in-a-included-partial-how-do-you-render-the-original-page-with-validation-errors
[19:42:51] P-NuT: has joined #RubyOnRails
[19:47:02] Rodya_: has joined #RubyOnRails
[19:51:52] Terens: has joined #RubyOnRails
[19:52:25] jhfisc: has joined #RubyOnRails
[19:58:53] jhfisc: has joined #RubyOnRails
[20:04:03] pwnd_nsfw: renegadeandy, https://stackoverflow.com/questions/5175385/where-to-render-comments-controller-in-rails-on-model-validations-failure
[20:04:05] pwnd_nsfw: does this help?
[20:04:08] jhfisc: has joined #RubyOnRails
[20:04:13] pwnd_nsfw: linked to from https://stackoverflow.com/questions/6516328/how-to-render-validation-errors-on-the-page-that-submitted-the-form
[20:04:42] pwnd_nsfw: https://stackoverflow.com/questions/33370921/how-to-render-validation-errors-of-form-partial-rails
[20:04:44] pwnd_nsfw: horray for google
[20:04:44] P-NuT: has left #RubyOnRails: ("Leaving")
[20:06:21] quirkycoders: has joined #RubyOnRails
[20:06:32] IsoLinCHiP: has joined #RubyOnRails
[20:07:19] renegadeandy: pwnd_nsfw: so i assign an instance variable to the view....but how do i make sure this is handed to the partial?
[20:07:29] pwnd_nsfw: It's just how rails works
[20:07:35] pwnd_nsfw: if the partial is rendered in the show view of the code
[20:07:37] AnotherOne: has joined #RubyOnRails
[20:07:51] pwnd_nsfw: You're supposed to hand the partial the instance variable via it's parent view anyways
[20:08:05] pwnd_nsfw: render "some_view", my_variable: @instance_of_my_variable %
[20:08:31] jhfisc: has joined #RubyOnRails
[20:09:39] IsoLinCHiP: Hi there, can anyone recommend a convenient way to interactively modify the session hash of a logged in user preferrably from the browser? Obviously only in dev environment ;-) I would like to interactively test various effects different values in the session hash have on the views and the controller.
[20:10:14] renegadeandy: pwnd_nsfw: i am not sure how to take what I have read and translate into my specific question. Can you help me and others by answering it on SO?
[20:11:12] pwnd_nsfw: <%= render partial: "legs/form", locals: {leg: @new_legs.first} %>
[20:11:26] pwnd_nsfw: That's not giving you the object that you're submitting, is it
[20:11:32] pwnd_nsfw: which is probably why it's not rendering errors
[20:19:05] renegadeandy: i suppose so pwnd_nsfw - so I change that to @leg, and change the show method in journeys to make a @leg, and the create in legs controller will automatically show the errors as it already has the @leg object? When I change the render in legs controller, create, to format.html { render "journeys/show" } i get a "undefined method `name' for nil:NilClass" error on that line.
[20:19:58] pwnd_nsfw: http://gist.github.com
[20:21:08] ascarter: has joined #RubyOnRails
[20:21:22] hahuang65: has joined #RubyOnRails
[20:22:35] renegadeandy: pwnd_nsfw: https://gist.github.com/renegadeandy/38886080e8299ab1dc8a3aab70fb1f2b
[20:22:52] pwnd_nsfw: add view code to the gist
[20:23:06] pwnd_nsfw: also, stop using scaffolds
[20:23:16] pwnd_nsfw: it's for people who like to delete code to rewrite it eventually
[20:29:03] netzfisch: has joined #RubyOnRails
[20:29:25] jaegerca: has joined #RubyOnRails
[20:31:03] renegadeandy: i dont use them generally pwnd_nsfw it was used to create the files and now deleting code haha . It now contains view code : https://gist.github.com/renegadeandy/38886080e8299ab1dc8a3aab70fb1f2b
[20:36:01] pwnd_nsfw: renegadeandy, why are you mixing simple_form_for and regular form code... da fuck is going on in this mess lol
[20:36:07] hahuang65: has joined #RubyOnRails
[20:36:17] xco: has joined #RubyOnRails
[20:36:57] renegadeandy: pwnd_nsfw: where?
[20:37:14] pwnd_nsfw: the entire _form.html.erb
[20:37:18] pwnd_nsfw: it's quite obvious
[20:37:34] renegadeandy: thats all simple_form code...
[20:37:53] renegadeandy: anyway - that works and is valid so whats wrong with it?
[20:38:07] renegadeandy: im not looking for a critique of how 'terribad' you consider my style?
[20:38:08] pwnd_nsfw: <label class="radio-inline">
[20:38:08] pwnd_nsfw: <input type="radio" name="mode" id="airport_type" value="car"><i class="fa fa-car"></i> Car
[20:38:18] pwnd_nsfw: What's wrong? You can't maintain that shit
[20:38:21] renegadeandy: that is umtidy
[20:38:26] renegadeandy: and ill tidy that
[20:38:41] pwnd_nsfw: Like, my brain is refusing to read any of that code
[20:39:10] renegadeandy: pwnd_nsfw: well. Thanks for your help.
[20:39:14] Terens: I am having a rails application. The problem is that I want to secure api with client certificates. One solution is to have at nginx ssl_verify optional and check validity at controllers of api.
[20:39:42] jhfisc: has joined #RubyOnRails
[20:39:49] Terens: However I know that some browsers are having trouble with optional client certificates
[20:40:04] Terens: is there a way to split it?
[20:44:26] IsoLinCHiP: Alternatively, does someone know how I could configure rails to not encrypt the cookies in develop environment? If I just delete the secret_key_base it errors out
[20:55:19] renegadeandy: If i do "format.html { render "journeys/show" }" the URL in the browser remains the previously submitted URL despite the page rendering the correct content. Anyway to make the URL update to the appropriate view for the rendered content?
[20:56:00] jhfisc: has joined #RubyOnRails
[20:58:56] pwnd_nsfw: renegadeandy, that's how a failed rails form works
[20:59:21] pwnd_nsfw: you can maybe store errors in a session... then carry it to the url you'll then redirect to..
[21:00:29] jgpawletko: has joined #RubyOnRails
[21:01:00] jphase: has joined #RubyOnRails
[21:02:30] jhfisc: has joined #RubyOnRails
[21:02:48] brent__: has joined #RubyOnRails
[21:03:49] brent__: has joined #RubyOnRails
[21:11:13] netzfisch: has joined #RubyOnRails
[21:11:33] jhfisc: has joined #RubyOnRails
[21:12:17] arBmind: has joined #RubyOnRails
[21:17:26] frontrowalex: has joined #RubyOnRails
[21:25:08] jhfisc: has joined #RubyOnRails
[21:33:34] jhfisc: has joined #RubyOnRails
[21:34:43] LightStalker: has joined #RubyOnRails
[21:38:27] jhfisc: has joined #RubyOnRails
[21:38:45] patarr: Anyone have any ideas as to why I'm getting a Lost connection to MySQL error midway through my find_each loop on an AREL?
[21:39:01] patarr: I'm iterating over an object that has a custom base class that establishes a connection to a different DB
[21:39:36] patarr: It doesn't behave consistently. If I put a byebug in there and play with the REPL a little, and then let it `continue` it will complete successfully.
[21:39:52] patarr: But most of the time it fails on the first. If i give it a few seconds of time on the breakpoint, it goes about half-way.
[21:40:07] patarr: Maybe this is a garbage collection issue... it's a lot of objects being queried and thrown away rapidly
[21:45:04] jhfisc: has joined #RubyOnRails
[21:48:19] Technodrome: has joined #RubyOnRails
[21:50:07] jhfisc: has joined #RubyOnRails
[21:52:52] jhfisc: has joined #RubyOnRails
[21:55:00] uksio: has joined #RubyOnRails
[21:55:30] lxsameer: has joined #RubyOnRails
[21:59:16] jhfisc: has joined #RubyOnRails
[22:07:41] jhfisc: has joined #RubyOnRails
[22:11:36] my123: has joined #RubyOnRails
[22:12:56] ahrs: has joined #RubyOnRails
[22:13:13] jhfisc: has joined #RubyOnRails
[22:21:25] jhfisc: has joined #RubyOnRails
[22:27:41] jhfisc: has joined #RubyOnRails
[22:32:55] jhfisc: has joined #RubyOnRails
[22:36:03] gusrub_: has joined #RubyOnRails
[22:36:46] centrx: has joined #RubyOnRails
[22:39:14] xx00__: has joined #RubyOnRails
[22:42:14] jhfisc: has joined #RubyOnRails
[22:44:01] Rodya_: has joined #RubyOnRails
[22:57:01] besfort: has joined #RubyOnRails
[22:58:45] Jayson_Virissimo: has joined #RubyOnRails
[23:01:20] jhfisc: has joined #RubyOnRails
[23:07:07] jhfisc: has joined #RubyOnRails
[23:13:17] quirkycoders: has joined #RubyOnRails
[23:13:42] jhfisc: has joined #RubyOnRails
[23:15:50] wethu: has joined #RubyOnRails
[23:16:38] anotherone2: has joined #RubyOnRails
[23:19:39] jhfisc: has joined #RubyOnRails
[23:20:30] fugee: has joined #RubyOnRails
[23:20:54] fugee: does an instance variabe have to start with a @ in order to be passed from controller to view?
[23:21:42] fugee: if a variable doesn't start with a symbol then it's considered to be for local use only?
[23:22:06] fryguy: fugee: in general, yes.
[23:23:05] jhfisc: has joined #RubyOnRails
[23:24:50] fugee: fryguy: here https://github.com/DustinFisher/acts-as-commentable-with-threading-example/blob/master/app/views/comments/_template.html.erb the author uses commentable in a view; He does initialize it in the controller, but if i try to do that it doesn't work, i get undefined for commentable
[23:25:03] ascarter: has joined #RubyOnRails
[23:25:25] fryguy: where is controller
[23:26:01] fryguy: and where is the view rendering this partial
[23:26:05] fugee: fryguy: https://github.com/DustinFisher/acts-as-commentable-with-threading-example/blob/master/app/controllers/comments_controller.rb
[23:26:48] fugee: https://github.com/DustinFisher/acts-as-commentable-with-threading-example/blob/master/app/views/comments/_template.html.erb
[23:26:57] fryguy: that's the partial, where is the view
[23:27:15] fugee: i said view, i meant partial
[23:27:25] fryguy: where is the view
[23:28:01] fugee: https://github.com/DustinFisher/acts-as-commentable-with-threading-example/blob/master/app/views/beers/show.html.erb
[23:28:41] fryguy: and what is the error you are getting?
[23:28:43] fugee: i see locals: {commentable: @beer, ...
[23:30:06] besforto: has joined #RubyOnRails
[23:30:33] br0d1n: has joined #RubyOnRails
[23:31:04] Radar: GOOD MORNING
[23:31:49] fugee: fryguy: even still i'm passing commentable type and id i don't need the commentable object to be passed from the view
[23:32:41] mices: in his example he doesn't have a link to comment he just renders a comment form for every iteration
[23:32:55] jphase: has joined #RubyOnRails
[23:33:08] mices: not iteration, for the show view
[23:33:49] quirkycoders: has joined #RubyOnRails
[23:40:12] gusrub: has joined #RubyOnRails
[23:43:19] cam27: has joined #RubyOnRails
[23:46:55] gusrub: has joined #RubyOnRails
[23:49:44] jhfisc: has joined #RubyOnRails
[23:52:25] jhfisc: has joined #RubyOnRails
[23:56:21] cseder: has joined #RubyOnRails
[23:57:42] jhfisc: has joined #RubyOnRails
[23:58:23] DLSteve: has joined #RubyOnRails