Activity Graph

Page 1 of 7 | Next »


[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.


[02:24:17] amperry: so I have a controller action that looks for a placement, and and if block: "if @placement.nil? ; redirect_back fallback_location: '/transfers' ; end". @placement.nil? is true, but I'm not redirect-ing back. Anything wrong with my syntax or semantics here?
[16:52:17] amperry: kapil___:
[16:57:50] amperry: Anyone know why redirect_back would fail? I have a conditional, if @placement.nil?, which fails to redirect_back even when @placement is, in fact, nil. Gist: <-- although it doesn't say much more than what I just have.
[18:29:23] amperry: Andr3as: sorry, I was away for a bit. It is literally nil. I checked after throwing 'byebug' in there.
[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 :)


[18:47:58] amperry: has joined #RubyOnRails
[18:49:06] amperry: hi folks, got a question about the most efficient way to get a set of results by association value and their counts. I can do it in a loop, but it's horribly inefficient. Gist here:
[21:23:51] amperry: If I have a Lease object with many MonthlyChare associations and I want to create a new lease with the same or very similar charges, would I do something like "lease.monthly_charges.each do |mc|; new_charge = mc.dup; new_charge.lease_id = new_lease; end"?
[21:24:45] amperry: or, if the new_lease weren't saved, would that just be = new_lease?
[21:40:08] amperry: tycoon177: I think you want to use the "belongs_to ... counter_cache: true" option
[21:41:22] amperry: I have no idea if it's the best way :P, but it's *a* way
[21:41:58] amperry: you can add counts to your query, but I always end up struggling with the syntax on that
[22:41:58] amperry: hey folks, I'm trying to copy a bunch of associations from an existing object to a new one: "placement.monthly_charges.each do |mc|; new_charge = mc.clone; new_charge.placement = new_placement; end"
[22:42:50] amperry: placement has_one :lease, and has_many :monthly_charges, but when I try to save it, I get the error: "Validation failed: Lease monthly charges placement must exist"
[22:43:31] amperry: and I think I see what I forgot to do... hrm
[22:49:15] amperry: nope... question: how do you dup a bunch of associations into a new object, in general?
[22:59:24] amperry: Radar: sure, it'll be a moment
[23:18:21] amperry: Radar: here it is:
[23:25:46] amperry: it's actually on the! line, but let me take a look at the charges before that point.
[23:26:08] amperry: I'll add the output to the gist.
[23:27:25] amperry: Radar:
[23:29:08] amperry: they look *mostly* fine, although I see they have a placement_id and a lease_id (the latter of which they shouldn't need), and the lease_id is for the old lease.
[23:36:32] amperry: I really don't understand what that HasManyThroughCantAssociateThroughHasOneOrManyReflection error means, though.
[23:47:20] amperry: Smedley_: people are here
[23:47:34] amperry: don't know if any of us can help you, but some are here


[16:31:05] amperry: Read error: Connection reset by peer


[00:28:27] amperry: hey folks, I'm having trouble in production getting my assets (images, css, js) to load, and every page hit generates around 263 error messages. Gist here: <--- but I don't know what files to add to it.
[00:33:11] amperry: Radar: deployment has been an endless slog of two steps forward, one step back :(
[00:46:03] amperry: Radar: if I could have, I would have.
[00:46:51] amperry: believe me, that is something that I wish was on the table for me.
[01:17:45] amperry: anyone know how to find out where Rails decides to look for a particular asset? Not necessarily the directory, but the hashed name?
[01:27:32] amperry: fryguy: there's a zero-length manifest-<long_hash>.js file there, but that's all.
[01:29:10] amperry: there's a hidden (also zero-length) .sprockets-manifest-<long_hash>.json file.
[01:30:11] amperry: part of the problem is, rails is looking for files that don't exist, even if you accounted for fingerprinting.
[06:29:35] amperry: has left #RubyOnRails: ("ERC (IRC client for Emacs 24.5.1)")
[18:06:32] amperry: has joined #RubyOnRails


[20:22:06] amperry: then (unless I'm really misunderstanding the question) the association on Product, that it 'belongs_to :department', is really all you need.
[20:26:37] amperry: Okay. I'm looking at the Statesman gem for the first time now, so my advice might not be the best, I'm afraid. But I do see this, and it raises questions in my mind, too:
[20:26:57] amperry: State behaviour is defined in a separate, "state machine" class, rather than added directly onto a model. State machines are then instantiated with the model to which they should apply.
[20:28:01] amperry: I don't know anything more than that, unfortunately.
[20:31:11] amperry: you don't have to, but it will probably be cleaner to do so. Removing and replacing gems is a pretty painless process, though.
[21:06:43] amperry: anyone know how to troubleshoot/fix an ActionController::InvalidAuthenticityToken eror? Gist:
[21:57:01] amperry: Radar: yes
[21:57:04] amperry: sorry, afk for a bit
[21:57:50] amperry: the only thing is, I don't know why this would show up in production and not in dev.
[22:03:30] amperry: Radar: how would I check to see how I make this happen in my application? (Adding the line to PasswordsController didn't affect anything on production.)
[23:17:48] amperry: Radar: (and anyone who is interested): the problem was a setup in nginx, nothing to do with my code. (I did not set out to be the web admin for this project, dammit.)
[23:19:03] amperry:, for those who might be interested. Federico Moretti's solution worked for me.
[23:34:58] amperry: anyone here good with both rails and nginx?
[23:37:29] amperry: Now that I can login (after changing my nginx.conf), I can't log out.