So at work, we switched from using the aws-s3 gem (unofficial) to the aws-sdk gem (official), since the new paperclip gem version required it. Added a new initializer file and made a few changes in how we were opening the S3 connection. No big deal. Until we got to the part where we were opening … [Read more…]
So you’ve created a table of groups that are in a hierarchy with the gem ancestry, and you’ve created a table of users, and you’ve joined users to groups with a join table. And now you want to use Thinking Sphinx, which is awesome for searching. So you think, hey, wouldn’t it be great if … [Read more…]
This gets really old: if params[:teacher] && params[:teacher][:id] … so instead, do this: if params[:teacher].try(:, :id) or do it a lot more: name = params[:company][:owner][:name] if params[:company] and params[:company][:owner] and params[:company][:owner][:name] turns into: name = params.try(:, :company).try(:, :owner).try(:, :name) Yay for Stack Overflow!
<%= select_tag “some_select”, (“<option></option>” + options_from_collection_for_select(@foo, “id”, “item”)).html_safe %>
via Deploy Hook UPDATE 4.10.2013: Updating these instructions to use bundle exec, per chintan/Nic Pillinger UPDATE 11.4.2013: Updating these instructions to use helper methods to determine which instances to run the command on If you want your crontab updated by whenever on deploy, make a file named deploy/before_restart.rb and stick this in it: on_app_master do … [Read more…]
Interesting tidbit about a new law that is being passed. IL Senate Bill 840 allows for “Cottage food operations” (i.e. you can use your home kitchen), with several stipulations, if and only if you are selling goods at a farmers’ market. So if I wanted to sell my cakes at a farmer’s market and got … [Read more…]
The documentation for jsTree is thorough, but not particularly easy to read. If you are looking for an easy way to add “Expand All” and “Collapse All” buttons, here’s one way: <input type=”button” value=”Collapse All” onclick=”$(‘#tree_container_id’).jstree(‘close_all’);”> <input type=”button” value=”Expand All” onclick=”$(‘#tree_container_id’).jstree(‘open_all’);”> where ‘#tree_container_id’ is, of course, the ID of the container node for your tree.
Uploadify is a pretty awesome jQuery/flash uploader. It’s made even more awesome by the stuff you can do with it on the fly. For example, if you want to pass a variable chosen from a dropdown via the uploader, you can use uploadifySettings() to do so. Some people appear to have problems with this part, … [Read more…]
Here’s an interesting read from Ars Technica: Did file-sharing cause recording industry collapse? Economists say no The most interesting paragraph I see in this article is this one: So what is emerging is an increasingly “ephemeral” global music culture based not upon the purchasing of discrete physical packages of music, but on the discovery and … [Read more…]
I have a textarea with the id of “request_details”, made into a CKEditor instance by jQuery: $(‘#request_details’).ckeditor(); (Check this page if you need some help getting CKEditor to work with jQuery, it’s dead simple) Feature looks like this: And I fill in “Here are some details” in the CKEditor instance “request_details” Step looks like this: … [Read more…]