Activity Graph

Page 1 of 7 | Next »


[07:23:00] amperry: has joined #RubyOnRails
[07:24:34] amperry: Starting up 'rails s', I'm getting the error "unable to monitor directories for changes", the one that recommends I go to to see how to fix it. But it just started happening. I rebooted, and am running no other rails process. Why would that happen?
[07:41:31] amperry: Quit: going to be


[00:04:58] amperry: weaksauce: an AR model
[00:12:04] amperry: weaksauce: correct, if you're talking about leases#update.
[00:19:13] amperry: hmmm... let me see...
[00:22:17] amperry: weaksauce: thanks, for some reason accessing the attributes with [] didn't occur to me
[00:36:44] amperry: Quit: Thanks, all, see ya later


[18:35:08] amperry: has joined #RubyOnRails
[18:36:59] amperry: Hey folks, I've got a page I want to reload on a change to a select tag, passing the selected value back to the same controller. (A query might return several results, and I want the user to be able to select one). How is that done?
[18:38:41] amperry: I don't see how form_with, link_to, or button_to would do it, and I've tried to create a jquery event listener, but I'm hoping there's a more rails-idiomatic way because I suck at js.
[19:08:55] amperry: Quit: lunch
[23:52:45] amperry: has joined #RubyOnRails
[23:58:23] amperry: I have a class, Lease, with several date attributes ('start_date', 'end_date', et al); if I wanted to assign them in a loop, how would I do that, assuming I have those keys in a hash? (I can't use lease_params at this point.)


[14:47:11] amperry: has joined #RubyOnRails
[14:49:05] amperry: hey folks, anyone here use the cocoon gem? I'm trying to add associations calling link_to_add_association multiple times, but when I look at the params, only the last one is passed, rather than an array or other set of them.
[16:11:08] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[22:10:43] amperry: has joined #RubyOnRails
[22:11:53] amperry: hey folks, I've got a scope for a model, Unit.non_revs, which, to_sql, becomes "SELECT `units`.* FROM `units` WHERE `units`.`non_revenue_status_id` IS NOT NULL AND `units`.`null_unit` IS NULL".
[22:13:03] amperry: In the console, I've looked for one unit, u, which I *know* has a non-null 'non_revenue_status_id', and a null 'null_unit'; but Unit.non_revs gives me empty brackets.
[22:14:28] amperry: I don't even know how to troubleshoot this from here.
[22:17:11] amperry: lupine: find_by_id works; when you say by the two args directly, you mean something like Unit.where.not(non_revenue_status_id: nil) ?
[22:17:32] amperry: because u.non_revenue_status_id = 6, which is a valid value, and u.null_unit is nil
[22:20:27] amperry: yeah; it might be that I've changed something in the console and haven't saved it, derp.
[22:20:48] amperry: yup, just me being fuzzy-headed
[22:21:03] amperry: lupine: but thanks anyhow
[22:30:19] amperry: Quit: Thanks, bye for now


[19:05:25] amperry: has joined #RubyOnRails
[19:09:30] amperry: Hi folks, I'm having a problem with the cocoon gem and a has_many association. When I add multiple associated records to an object, only the last one gets passed to params. (Also, the autonumeric gem doesn't seem to work for fields in the associated record's partial). Gist here:
[19:17:10] amperry: Okay, after some cosmetic editing, problem #2 in my little gist there is fixed, so now I'm just wondering why autonumeric isn't working.
[19:22:26] amperry: Ne'ermind, RTFM'ed on the autonumeric as well.
[19:22:35] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[16:44:16] amperry: has joined #RubyOnRails
[16:47:50] amperry: I have weird behavior with a form submission where the request hits the controller and the console claims to render the page for the next action, but the browser window doesn't appear to change (i.e., it's still on the page with the form). Anyone have a guess as to why that might happen?
[17:25:44] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[19:28:22] amperry: has joined #RubyOnRails
[19:31:31] amperry: hey folks, if a controller method is reached and the console claims to have rendered a page, but the previous page still displays, are there any common causes for this?
[20:05:19] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[02:15:55] amperry: has joined #RubyOnRails
[16:11:19] amperry: Ping timeout: 246 seconds


[15:56:57] amperry: has joined #RubyOnRails
[16:05:08] amperry: hey folks, I've got a weird 'byebug' problem. I've put it as the very first line in a controller method, but when I invoke that action, I'm dumped into /gems/devise-4.6.1/lib/devise/controllers/helpers.rb, in 'def current_#{mapping}' instead of the first line of my method.
[16:05:12] amperry: why would that be?
[16:05:59] amperry: the *second* line of that method is Pundit.policy_scope call.
[16:07:29] amperry: although stopping and starting the server seems to have fixed it, ne'ermind. I just hate to do the IT Crowd fix without knowing why
[16:18:50] amperry: Quit: ERC (IRC client for Emacs 25.2.2)
[18:52:39] amperry: has joined #RubyOnRails
[18:53:49] amperry: hi folks, anyone know of of good troubleshooting steps for when best_in_place isn't working in Rails 5? I've got a boolean toggle that doesn't change when I click it and don't really know where to go from there.
[21:25:53] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[07:21:20] amperry: has joined #RubyOnRails
[07:24:11] amperry: hey folks, something happened to my schema.rb file, so I removed it and tried to recreate my db using 'rails db:create'. I'm getting the error during a create_table operation: "Table 'rb.residents' doesn't exist". Of course it doesn't, that's the point of running the migration.
[07:24:20] amperry: what could be wrong with me/it?
[07:25:23] amperry: FWIW, six other files were read and six other tables created before it.
[07:50:56] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[09:48:10] amperry: has joined #RubyOnRails
[10:04:15] amperry: anyone here familiar with what I'm sure must be a common Devise error? I'm getting an "Invalid Email or password" error on a login form; cf.
[10:51:20] amperry: Quit: ERC (IRC client for Emacs 25.2.2)
[12:46:32] amperry: has joined #RubyOnRails
[12:47:39] amperry: hi folks, anyone know how to troubleshoot when '<%= yield %>' doesn't seem to yield anything?
[12:51:57] amperry: ss942: seems like I was missing a route. But where would I put the Rails.logger.error, assuming (as it was in this case) that no error was logged? (I.e., what 'some string' would I look for?)
[13:03:20] amperry: Giorgio: that's what I would have expected. But it simply silently declined to render anything in the '<%= yield %>' section.
[13:10:02] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[00:54:58] amperry: has joined #RubyOnRails
[00:56:04] amperry: hi folks, I was just creating a new project (5.2.2) to test something out, and now when I run 'rails g scaffold checkbook', the command just hangs there. Usually this is something that takes 10s at most.
[01:02:45] amperry: of course, maybe I should check my capitalization
[01:13:29] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[13:48:16] amperry: has joined #RubyOnRails
[13:50:14] amperry: hi folks, anyone be able to help me locate why I'm getting an ActionView::Template::Error (wrong number of arguments) when neither the message nor anything I can find in the logs says *where* this is happening?
[13:50:29] amperry: gist here:
[13:51:36] amperry: and, just to be certain, is anyone else awake in here?
[13:56:57] amperry: is there a way to force ActionView::Template::Error to be more verbose?
[13:58:48] amperry: I can, but also here, the entire text of the error: "An error of type ActionView::Template::Error happened; message is: wrong number of arguments (given 2, expected 0)."
[13:59:15] amperry: come to think of it, that is in the gist
[13:59:37] amperry: you'd think that, wouldn't you?
[14:00:08] amperry: but it isn't doing that; what I have is the entire text of everything it's telling me.
[14:00:17] amperry: a pdf renders with a header, and that message
[14:00:44] amperry: nothing I can see
[14:06:39] amperry: I was hoping someone would see the wkhtmtopdf part and say "oh, yeah, wkhtmtopdf always does that because <reason>"
[14:08:10] amperry: me no google magic on this one
[14:30:20] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[19:24:34] amperry: has joined #RubyOnRails
[19:26:47] amperry: Hey folks, getting an ActionView::Template::Error with a pdf render attempt. Gist here:
[22:09:18] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[18:05:49] amperry: has joined #RubyOnRails
[18:11:02] amperry: hi folks, if I want two separate levels of access to a model (admin and regular), is there anything funky about having two controllers, one under /app/controllers and one under /app/controllers/admin?
[18:32:44] amperry: ne'ermind, I just decided to test it, and it all looks good
[18:32:49] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[16:49:50] amperry: Quit: ERC (IRC client for Emacs 25.2.2)


[21:31:31] amperry: Read error: Connection reset by peer
[21:31:45] amperry: has joined #RubyOnRails
[21:38:13] amperry: Read error: Connection reset by peer


[19:02:09] amperry: has joined #RubyOnRails
[19:02:53] amperry: hi folks, can anyone tell me why this works: <%= link_to "Monthly Charges", "/monthly_charges_report?format=pdf", start_date: start_date, end_date: end_date, target: 'blank' %>
[19:03:40] amperry: but this doesn't: <%= link_to "Monthly Charges", "/monthly_charges_report", format: 'pdf', start_date: start_date, end_date: end_date, target: 'blank' %>


[07:31:00] amperry: Remote host closed the connection


[14:02:22] amperry: hi folks, anyone know of either a rake task I can schedule with the 'whenever' gem, or the right way to set up the environment in a crontab to (a) see if a rails server is running, and (b) if not, restart it?
[14:02:54] amperry:, for context
[14:03:17] amperry: dminuoso: how do I not do that?
[14:04:26] amperry: should be a one-line entry in a crontab, but there seems to be some context and environmental variables that don't get set up when I'm not logged in, and I don't know what all of them are.
[14:14:13] amperry: dminuoso: I don't even know how I'd write the script if "ps auwwx | grep -v grep | grep puma || rails s" works from the command line, but "ps auwwx | grep -v grep | grep puma || /every/path/ive/tried/rails s" fails in a crontab
[14:15:05] amperry: ACTION didn't want to be sysadmin for this, but stumbled into it
[14:16:12] amperry: dminuoso: Scrabe?
[14:20:38] amperry: dminuoso: I'll try that, but that still doesn't get to the problem I'm facing, which is, once I see the server isn't running, how do I get it to start?
[14:22:33] amperry: I'd been just running "rails s" from the command line. (I'm utterly unprepared to be the sysadmin, but the task fell on me against my wishes.)
[14:26:38] amperry: dminuoso: okay. Starting from the ground up, I'm looking at; do you recommend another resource?


[20:24:18] amperry: has joined #RubyOnRails
[20:27:37] amperry: Hi folks, I'm getting an error that I have very little to go on, so as a workaround until I can fix that, I want to use either a cron job or scheduled rake task to check if the server is up, and if not, to restart it. I'm having bad luck with the cron approach, however, and I have no idea what a rake task would look like to do this.
[20:27:42] amperry: cf.


[19:12:50] amperry: has joined #RubyOnRails
[19:15:04] amperry: hi folks, I have a problem that is more server-level than code-level: -- basically, HT run `rails s` in a crontab entry to ensure availability in the case of an error making the server process fail. (The question of *why* it's failing is another thing altogether.)
[23:12:25] amperry: Quit: places to be


[19:00:14] amperry: has joined #RubyOnRails
[19:00:56] amperry: hi folks, anyone familiar with using MySQL/mariaDB views as the basis of an ActiveRecord model?
[20:00:34] amperry: Quit: got afternoon stuff to do


[11:44:45] amperry: Ping timeout: 256 seconds


[20:41:15] amperry: has joined #RubyOnRails


[15:19:17] amperry: has joined #RubyOnRails
[15:21:09] amperry: hi folks, I'm using the nested_form gem and I'm trying to direct to an action, placements#_lease. I've go a line in the template that looks like this:
[15:21:30] amperry: <%= nested_form_for @placement, controller: :placements, action: "_lease" do |f| >
[15:21:45] amperry: ... but the rendered html looks like this:
[15:22:09] amperry: <form autocomplete="off" class="edit_placement" id="edit_placement_95" action="/placements/95" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="_method" value="patch" /><input type="hidden" name="authenticity_token" value="iYKUSecLvo3KP53XOp9Fecu2LP8INsVR0UjdoZfO4L+cOZLwAuDPn4q51UA7yeFhvsp3oat+Ju4fB6uhYeGK4A==" />
[15:23:54] amperry: Any idea what I'm doing wrong? How do I make the form go to the action I want it to?
[15:30:28] amperry: Inside: let me try that.
[15:36:45] amperry: Inside: looks like that did it, thanks. (Now off to fix the subsequent errors, sigh...)
[15:42:30] amperry: if I weren't freelancing, I would. But as I'm behind schedule, "security" is the last thing I'm feeling :(
[15:43:40] amperry: I started this thing with (a) a much higher opinion of my Rails skills than I really had, and (b) a much lower appreciation for how messed up the client's original app was.
[18:40:38] amperry: dminuoso: agreed, but what it really lacks is an agreed-upon architecture for doing non-CRUD activities.
[19:43:20] amperry: gotta reboot, see y'all later
[19:43:34] amperry: Quit: reboot


[20:14:56] amperry: has joined #RubyOnRails
[20:15:15] amperry: Client Quit


[17:01:21] amperry: Ping timeout: 248 seconds
[17:04:14] amperry: has joined #RubyOnRails
[17:06:49] amperry: Read error: Connection reset by peer


[21:38:23] amperry: has joined #RubyOnRails
[21:42:56] amperry: Hi folks, in addition to STI, how can you model OO-style inheritance between tables with Rails? (I might be fine with STI alone, but I'm looking for options.)
[21:50:13] amperry: GOOD MORNING, RADAR
[22:45:41] amperry: is there a method or command in the rails console to list an object/model's associations?
[22:50:51] amperry: Radar: groovy, thx
[22:58:08] amperry: does it make sense for one model to 'has_many' another model, and the other model to 'has_many' that model, without either of them 'has_and_belongs_to_many'? I'm tempted to try something, but the idea sounds dumb to me.
[23:04:17] amperry: dionysus69: yeah. right now I have a have a model, Placement, which has_many Residents, which (most of the time) act like they belong_to that one Placement. But a Resident can move, and get a new Placement. Placement is a container for everything rental related, including Lease, Apt, Residents, and Ledger.
[23:05:26] amperry: they can also sign a Lease before moving, or renew a Lease (which is not really 'renewing' it, but it's really signing a new one), so they can still be in their current Placement while awaiting the move to the new one.
[23:07:56] amperry: Placement is a container; I would have gone with Lease, but a Resident can be associated with an Apt by placing a deposit on it before they actually sign. This is based on an old app that didn't even have a Lease table, but instead (a) listed everybody on the Lease as a single resident, and (b) created a new Resident every time they moved or re-signed.
[23:08:05] amperry: to give you a taste of the insanity I'm working with.
[23:09:33] amperry: so I needed a way to group people together and conditionally associate them with an Apt, even if they don't sign a Lease, because a non-refundable deposit fee is associated with the Apt and I need to account for that.
[23:11:56] amperry: 19/20 times or more, I'll be querying their present location; but there are some reports and some odd processes that need to see their past locations (including two roommates who go their separate ways) and possible future/prospective one.
[23:12:54] amperry: sorry for the info dump, but you asked :S
[23:58:14] amperry: has left #RubyOnRails: ("ERC (IRC client for Emacs 24.5.1)")
[23:58:47] amperry: has joined #RubyOnRails
[23:58:58] amperry: well, that was unintended


[03:01:22] amperry: Quit: ERC (IRC client for Emacs 24.5.1)


[00:21:06] amperry: has joined #RubyOnRails
[00:23:31] amperry: hi folks, got a question. It looks like, with cocoon, you can't transitively add an association through belongs_to -> has_many. In more concrete terms, my model, Lease belongs_to the model Placement, which has_many MonthlyCharges. I'm trying to use cocoon's link_to_add_association to add one or more MonthlyCharges to the Lease. gist here:
[00:24:17] amperry: seems like you maybe can't do that, but I'm wondering what my options might be at this point.


[09:33:05] amperry: Ping timeout: 240 seconds


[00:42:31] amperry: has joined #RubyOnRails
[00:42:53] amperry: hi folks, anyone here use Trailblazer?
[14:23:25] amperry: anyone here use Trailblazer?
[14:40:15] amperry: havenwood: tried implementing a service with tb, could not understand what was going wrong.
[14:40:34] amperry: havenwood:
[14:41:22] amperry: now rewriting it as a "vanilla" service object, because at least I understand the calling semantics.
[14:51:26] amperry: Read error: Connection reset by peer
[14:51:44] amperry: has joined #RubyOnRails
[15:04:24] amperry: Read error: Connection reset by peer
[15:07:58] amperry: has joined #RubyOnRails
[15:14:09] amperry: Ping timeout: 264 seconds
[15:20:48] amperry: has joined #RubyOnRails


[20:54:06] amperry: Read error: Connection reset by peer


[19:35:13] amperry: has joined #RubyOnRails
[19:37:04] amperry: hi folks, I fear the answer is "no, you've got to roll your own", but can someone confirm that you cannot do transitive (i.e., `:has_many :through`) associations when using cocoon's `link_to_add_association` helper? Gist here:
[19:43:00] amperry: afk, going to look up nested forms using jquery, et al; I really think there's no way to get cocoon to do it.
[21:29:00] amperry: so if I have a method, placements#sign_lease, how do I create a link_to it? I've tried this:
[21:29:03] amperry: <td><%= link_to 'Move In', :sign_lease , method: :post, id: %></td>
[21:29:43] amperry: but the link that creates doesn't include the id, and therefore neither does the resulting params hash.
[22:01:08] amperry: anyone here at the moment?
[22:02:42] amperry: curious: I've got a method, placements#sign_lease, and a link that goes to http://localhost:3000/sign_lease/71, but I seem to be sidestepping placements#sign_lease.
[22:03:07] amperry: also, a route: POST /sign_lease/:id(.:format) placements#sign_lease
[22:03:41] amperry: but I have byebug in the definition of sign_lease, and I'm not hitting it; instead, I'm redirecting to the home page
[22:04:39] amperry: are there common reasons why this would be?
[22:06:16] amperry: I'm not 100% on that, but I *think* so.
[22:06:34] amperry: I mean, the view where the link is created looks okay (now).
[22:07:11] amperry: And I would expect rails to halt inside 'def sign_lease' before it complained about missing templates or something.
[22:07:44] amperry: hard to say; relatively small, but there are definite oddities about it due to how weird the legacy data is.
[22:13:28] amperry: samort7:
[22:14:11] amperry: I know there's some silliness in the '@lease = @placement.build_lease' and such
[22:16:27] amperry: I might. This is a pretty nascent method right now, I was just wondering why I couldn't actually get to it.
[22:17:34] amperry: and now, with some fiddling, I think I've got it, but still have no real indication of what was wrong in the first place.
[22:18:21] amperry: samort7: thanks for being a sounding board, anyhow
[22:19:39] amperry: okay, here's weirdness:
[22:20:33] amperry: the link_to call specifies 'method: :post', but if I remove "get '/sign_lease/:id'" from routes.rb, it doesn't go to the right place.
[22:22:10] amperry: so if params[:method] = "post", has it really been posted?
[22:35:16] amperry: samort7: googling and seeing something about jquery and turbolinks, so that could be something. Won't be the first time Rails' magic was a little too little David Copperfield and a little too much David Blaine.
[22:37:38] amperry: samort7: thx
[23:06:35] amperry: Read error: Connection reset by peer
[23:08:58] amperry: has joined #RubyOnRails
[23:14:35] amperry: Read error: Connection reset by peer
[23:55:14] amperry: has joined #RubyOnRails


[19:53:57] amperry: has joined #RubyOnRails
[19:55:07] amperry: hey folks, brain freezing here for a second: is there an easier way of writing this: r.lines&.select {|line| >= start_date }.select {|line| <= end_date }
[20:20:02] amperry: dminuoso: thanks.
[20:20:08] amperry: brain no worky today
[20:48:44] amperry: Read error: Connection reset by peer
[20:49:04] amperry: has joined #RubyOnRails
[23:03:10] amperry: Quit: ERC (IRC client for Emacs 24.5.1)


[22:42:40] amperry: Remote host closed the connection


[22:09:03] amperry: has joined #RubyOnRails
[22:10:49] amperry: Hey folks, git cloned a repository into a new host and am having trouble getting 'bundle install' to work. I get the error: "An error occurred while installing ffi (1.9.21), and Bundler cannot continue. Make sure that `gem install ffi -v '1.9.21'` succeeds before bundling." and I can't get `gem install ffi -v '1.9.21'` to work, either.
[22:11:25] amperry: it tells me to check a temp file which does not exist for more detail.
[22:20:36] amperry: nope, ubuntu
[22:20:52] amperry: ruby is: 2.3.1p112
[22:21:15] amperry: ubuntu is 16.04.1
[22:28:27] amperry: although it seems like this answer does the trick:
[22:36:45] amperry: tycoon177: it seems unfortunate, but ultimately inevitable, that one needs to issue (multiple) administrative commands to enable what is (at least in part) a package manager to succeed.
[22:36:50] amperry: but yes, that did it.
[22:40:38] amperry: I get it, it just becomes frustrating, especially when the error messages are not informative :(


[05:03:11] amperry: Remote host closed the connection


[01:55:15] amperry: *.net *.split
[01:55:39] amperry: has joined #RubyOnRails


[02:34:21] amperry: desnudopenguino: still here? I can gist what I have.
[02:35:54] amperry: actually, I'm having other troubles with it now.
[03:01:36] amperry: desnudopenguino: one moment, I'll gist it
[03:01:54] amperry: (Been in and out of the room, as perhaps you might have guessed.)
[03:05:01] amperry:
[18:19:29] amperry: akryll: how can you get into something in 2017?
[18:25:50] amperry: I'm using simple_form_for to create an object, but the params are not getting set and I don't understand why not. Gist here:
[18:53:11] amperry: (meanwhile, in the land of non-hypothetical questions...)
[18:54:25] amperry: akryll: yup, that's me. Caught me red-handed, you did.
[18:57:04] amperry: does /ignore still work in irc?
[18:57:25] amperry: yes, yes it does
[19:12:31] amperry: fschuindt: just type "/ignore akry^H^H^H^Hwhomever" and you have your own mini-moderation function
[19:15:12] amperry: anyone know of a reason why simple_form_for wouldn't send params when it submits?
[19:44:10] amperry: on a different tack, how do you manually ensure that a submit button will send certain params?
[19:54:07] amperry: mattwc: that could be the problem. What I have is a form that basically presents what's going to be created, then asks for an "okay".
[19:55:01] amperry: So it looks like I just have to re-create the same variables in 'def create' action that I did in 'def new', which seems... whatever.
[19:56:19] amperry: so perhaps using a form was the wrong choice


[21:07:46] amperry: desnudopenguino: I had the same problem; sorry, I would have commented, but I wasn't 100% sure and I didn't want to send you chasing a red herring.
[21:29:50] amperry: personally, I think byebug is a hack around the fact that ruby doesn't (appear to) have a debugger that lets you dynamically set arbitrary breakpoints.
[21:31:12] amperry: if I'm wrong I'd love to be enlightened, though, because I really could use one if such a thing exists.
[21:38:48] amperry: Python has pdb and perl has the -d switch, which are not IDE-centric.
[21:41:58] amperry: I'm not saying it as a big criticism, just surprised that something like that wasn't considered with the language.
[21:53:02] amperry: ruby does have a -d switch, I see. I'm surprised it's not mentioned in any of the rails debugging stuff I've seen.
[23:48:29] amperry: what is the trick to tell simple_form_for that you want a specific controller action (e.g., ":create")?
[23:51:09] amperry: I tried putting 'action: :create' in the simple_form_for() call and on the 'f.button :submit', neither of which worked.


[18:31:38] amperry: but I can check with 'blank', as well.
[22:37:44] amperry: kapil___: happy my small amount of knowledge could help :)