RailsCasts Pro episodes are now free!

Learn more or hide this

John Trichereau's Profile

GitHub User: Ganasist

Site: www.infinitory.com

Comments by John Trichereau

Avatar

Did you ever figure how to delete the reciprocal relationship? Seemed like an obvious omission in this otherwise excellent episode.

Avatar

Same. This might be a stupid question but do we need to activate a worker process in order for RedisToGo to work with Sidekiq on Heroku?

Avatar

Does this work with optimistic locking and a lock_version column set up? I'm getting:

ActiveRecord::StaleObjectError

ruby
class VersionsController < ApplicationController
  def revert
    @version =  PaperTrail::Version.find(params[:id])
    @version.reify.save!
    redirect_to :back, :notice => "Undid #{@version.event}"
  end
end

Problem is on line 4

Avatar

Hi here's the answer to my own question:

The latest versions of Papertrail actually namespace the Version class as PaperTrail::Version.

Problem solved.

Avatar

I had this working perfectly following this screencast and then some weeks later I went back to check on it and it was borked. Now I'm getting this error whenever I hit the undo button:

uninitialized constant VersionsController::Version

I have it set up exactly as in this screencast, but I have no clue what might have broken it.

Problem is on line 3 apparently:

class VersionsController < ApplicationController
  def revert
    @version = Version.find(params[:id])
    @version.reify.save!
    redirect_to :back, :notice => "Undid #{@version.event}"
  end
end

Any suggestions?

Avatar

This might be a very stupid question but unless I'm mistaken this approach requires pre-loading all the values for the dynamic select onto the client... I have too many for this and instead want to hit the server once for the relevant dynamic dropdown data once the primary selection has been made via AJAX.

Is this feasible?

Avatar

Everything works up until I switch the source to anything non-local (source: ['foo', 'food', 'four'] works fine).

This is the error I'm seeing in the console while typing for non-local data:

Uncaught TypeError: Property 'source' of object [object Object] is not a function

Any suggestions? My code is almost identical to the screencast.