Dan Frenette


4,890 Experience
41 Lessons Completed
1 Question Solved


Posted in Analytics with Segment Discussion

For anyone who isn't seeing events load in the debugger:

Make sure you have any adblockers switched off for localhost:3000 or any other website with this that you're testing!

Posted in How do I add opensearch to a Rails app

I think I'd have to describe that answer as delightfully frustrating :) I'm happy Chrome threw you a bone and just tacked it on. Maybe I just need to push my site up and see what happens. Either way, thanks so much for the response!

Posted in How do I do multiparameter filter

Not sure how you'd get this into a URL, but a very common gem I see for operations like this is ransack:


It generates a SQL query based on whatever the user puts in. It's very fast, but the one drawback is it only works with your database columns.

Posted in How to create many subcategories in rails?

So firstly, I used ancestry. I found it saved me a ton of time and, well, pain. Tree structures can get really crazy depending on what you're using them for. If you really don't want to use a gem, I recommend creating a Category model and adding a parent_id column that can be used in a belongs_to relation to point to it. Be aware though: things like eager loading, or even querying the full tree, in this instance get very difficult, and I'm not sure how you'd even go about those things without writing a lot of raw sql. Still, if you're really motivated, here's a nifty article on how to do that as well:


Posted in How do I add opensearch to a Rails app

I'm talking about the feature in chrome, it's present on GoRails, where if you type the URL of the site and hit Tab, you're able to search the site from the Chrome omnibar. I've gotten this to work with Firefox, and with just adding my site's search engine into Chrome, but for some reason I can't get the tab functionality to work.

Here's my XML file:

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
  <ShortName>My Website</ShortName>
  <Description>Something Short Here</Description>
  <Url type="text/html" method="get" template="<%= request.base_url %>/searches?q={searchTerms}"/>

and the link tag in my header:

%link{:href => open_searches_path, rel: "search", title: "Rails Garden", type: "application/opensearchdescription+xml"}/

Posted in Group Chat with ActionCable: Part 3 Discussion

This is definitely a noob mistake, but if you're not following along exactly with the app Chris is building, make sure you include the actioncable related JS files in application.js so that things actually load. That took longer than it should have to figure out...