Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Cameron Stitt's Profile

GitHub User: cam-stitt

Site: http://blog.castitt.com

Comments by Cameron Stitt

Avatar

Only just checked back, and will now be watching Part 2. Can fix up my dodgy fix :)

Avatar

I am sure you will put this in Part 2, but I am implementing this in an app right now and needed a way to ensure they were an admin for the associated member they were viewing.

ruby
if !current_permission.allow?(params[:controller], params[:action], params[:id])

Then you can use the Id to fetch and check on an item if needed.

ruby
return true if controller == "projects" && action.in?(%w[edit]) && Project.find(id).user == user
Avatar

I was having issues with upper/lower case searching with pg_search. I then went and changed my query to match something like to_tsvector('english', title) @@ to_tsquery('english', :q) and it worked. Do you have any ideas why this would be the case?

Avatar

I can confirm that this method works. Thanks for the example.