Sign in through GitHub

RailsCasts Pro episodes are now free!

Learn more or hide this

pctj101's Profile

GitHub User: pctj101

Comments by


I would just make it a nested resource if you could and grab it off the params array like params[:establishment_id]

So you would be on page like:

And that would post to

And you could pull off params[:establishment_id]


I went ahead and started a project with meteor then got stuck on a multi-table-join problem.

I documented it here:

For mainly this reason, I don't think meteor is production ready, but it certainly has some good ideas.


Current Gem:
gem 'mercury-rails', git: '', ref: '6d9c99fe20958ed87e4f1a05e9de19825af702ef'

My mod to mercury.js

onload: function() {
    Mercury.on('ready', function() {
      var link = $('#mercury_iframe').contents().find('#edit_link');
        console.log("mercury ready ready", link);
      mercuryInstance.saveUrl ='save-url');

    Mercury.on('saved', function() {
      window.location.href = window.location.href.replace(/\/editor\//i, '/');


So one thing about using "store" is that it doesn't transparently work for the .to_json calls.

For example:
store :properties, accessors: [:blah]

If you do:
@things.to_json(:only => [:blah])
You'll get back

If you do:

You'll get:
[{properties: {blah: "foo"}}]

Which just isn't as convenient for merging in with your "standard" backbone.js or other JSON related infrastructure.

I'm not sure if there' a better way using to_json, but I'm guessing you can rescue the situation using say jbuilder or writing your own to_json call.

I'd be glad to hear better ideas though!


What's the best way to limit cacheing to only one format?

For example, I only want to cache JSON responses.


From what I can tell, sometimes, if you do a massive update over all records in a table, you may not want to run the sweeper on every record save. So you only activate the sweeper when you know you need it, for example during a certain controller.

However, if your more typical use is CRUD in ActiveAdmin, well then... perhaps doing a model observer would work (never tried).