Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

pctj101's Profile

GitHub User: pctj101

Comments by

Avatar

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:
http://example.com/establishment/123/category/new

And that would post to
http://example.com/establishment/123/category

And you could pull off params[:establishment_id]

Avatar

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

I documented it here:
https://github.com/meteor/meteor/issues/147

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

Avatar

Current Gem:
gem 'mercury-rails', git: 'https://github.com/jejacks0n/mercury.git', ref: '6d9c99fe20958ed87e4f1a05e9de19825af702ef'

My mod to mercury.js

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

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


  }
Avatar

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:
@things.to_json

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!

Avatar

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

For example, I only want to cache JSON responses.

Avatar

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