Patrick Berarducci


470 Experience
2 Lessons Completed
0 Questions Solved


Try changing the "Add to Cart" "button" so it's not an input field. Try making it a submit button (e.g., "<%= f.submit .... [ whatever else ] ... %>") or just a button <%= f.button "Add to Cart" .... [whatever else]... %>

If im understanding correctly, just delete this: data-disable-with="Add to Cart"

Posted in Decorators From Scratch Discussion

Yea I learned of the technique in this context from Noel Rappin's book, Rails 4 Test Prescriptions (which is a great book, link here: He uses it for presenters, which I've used and liked.

Posted in Decorators From Scratch Discussion

Thanks, Chris, helpful as always! You also can use SimpleDelegator to handle the ActiveRecord (and delegation) issues. Here's an example

Posted in Screencast Request: iOS / Android Adapter Example

By "offline support", do you mean the ability for your app to work even when the user is not connected to the Internet? (As opposed to, for example, customer support.) I'm assuming that's what you mean, and if so, I don't have any experience. It's something I've thought about very briefly but never pursued much.

When I've thought about it, I've always thought I'd start here:

And then progress. This also seems useful, though not exactly on-point:

If you make progress on this issue let me know. I'd be interested in maybe trying to add this functionality depending on how it goes for you.

Posted in Screencast Request: iOS / Android Adapter Example

Hey Mark - Unfortunately I didn't find any great resources. The video I posted above was helpful -- if you watch it, you'll see how quick and easy it is to roll out a basic ios app. From there, for me, it was just a matter of trial and error and piecing together various resources (none of which, in isolation, was that helpful). Overall, I'd highly recommend trying this approach. It really is very efficient, especially if you're ok with have little-to-no native features at first (which, imo, is ok especially for a prototype or early stage).

A couple quick tips that come to mind:

  1. One of the things I spent a lot of time on was getting my ios app to have the correct navigation feel -- i.e., when you click a button, which way does the screen move, and what text displays on the iOS navbar (e.g., "back")? This was more iOS than rails. One way to cut through all of this, which I eventually discovered, was just hiding the iOS navbar and rolling with your standard rails web navbar. If you don't have a good amount of iOS experience, I'd recommend this approach for a quick prototype.
  2. Take a look at rails variants. They're pretty cool and make it easy to make just a single view file (including a partial) differ on your iOS app versus your web app.

Let me know if you need anything else, and good luck!

Posted in Background Jobs

Posted in IBM Watson

ANYONE WITH EXPERIENCE INCORPORATING WATSON INTO A RAILS APP? any resources or tutorials you found helpful? (Sorry caps are acting up)

FWIW, this is somewhat helpful:

Posted in Screencast Request: iOS / Android Adapter Example

Yea I think the adapters could be a real game-changer, especially for early-stage and small companies that can't afford to devote the resources to developing separate web and mobile apps (which happens to be where I'm at). I've done a lot of research and experimented with different options (e.g., React, Swift, React Native), but the Turbolinks 5 adapters seem the most promising for minimizing additional workload. This article by DHH has a good discussion of how they could be used:

Posted in Screencast Request: iOS / Android Adapter Example

Hey Chris -- Thanks for all the great content. I've been enjoying it for quite awhile; you do a great job, really. I'd love to see a short tutorial on how to take a rails app or a portion of a rails app and convert it into an iOS (or Android) app using the Turbolinks 5-based adapter(s). (As an example of a 'partial' app, maybe a site like Gorails would roll out an initial iOS app that only featured the screencasts, or only the community section; just a portion of the overall site.)

This is something I might try to do in the next couple of weeks and there aren't many good resources out there that I could find. I've watched your Turbolinks 5 videos, which are helpful but don't quite dive into actually building the iOS/Android app. (If you or anyone knows of any good resources, please let me know.) Thanks again for all your great work!

Posted in Dynamically Defined has_many with odd behavior

Maybe try adding the class_name to each dynamic has_many that you define

Ken - Your project looks great; I'll definitely follow along and maybe get involved when I come up for air! I think you should be able to incorporate Redux with an approach like this: If you use browserify, then I think you could include Redux (and any other js module) in the same manner that this article describes for including Jest. I played with this approach (not Redux, but using react and Reflux and ImmutableJS) last year and it worked. I'm about a month away from having to do this again in production. I'm not sure whether I'll follow this approach again or just bite the bullet and try react_on_rails. I'll definitely be interested in what you think/how you approach, so keep us posted!

On a separate but related note, I highly recommend Stephen Grider's two classes on Udemy -- "Modern React with Redux" and "Advanced React and Redux". They don't involve rails, but he does a great job teaching react and redux.

Greg - Not sure if you're still struggling with this, but I've been playing with doing something similar by building an aggregate form object that pulls together and utilizes all of the component form objects as and when needed. It seems to work, though I haven't quite finished everything yet.

Posted in Testing Turbolinks 3 partial replacement

Hey Chris (and everyone else) - Have you played around much with Turbolinks 3 partial replacement? (Chris, I wathed your livecoding segment; was great, thanks.) I'm using it with Rails 4.2.5, and it's working pretty well. My problem is that I can't seem to pick up the partial replacement in my feature tests (using Rspec/capybara/poltergeist). In other words, in my test, I'll visit the page, simulate the event (email entered and button click), and expect the resulting page to include the text from the partial replacement. But the text isn't showing up on the test page. I have js turned on. I couldn't afford to spend a ton of time trying to figure it out, so maybe I missed something. If anyone has any experience with this (e.g., you have or have not gotten tests to work for turbolinks 3 partial-replacement), I'd be interested to hear.

I did some googling and didn't find much on point. I can live without coverage on this for now, but if I can't figure out a testing strategy for partial replacement, I may not use it as much in other parts of the site. I can always resort to js links, react components or just standard page loads.