Вам нужно будет использовать before_filter
. Как то так:
class PersonasController < ApplicationController
before_filter :check_owner, :only => [:show, :edit, :update, :destroy]
def show
#...
end
#...etc.
protected
def check_owner
redirect_to personas_path unless params[:id] == current_user.id
end
end
Кроме того, примите совет @ davidb по написанию метода current_user
, если у вас его еще нет, который будет указан в вашем application_controller.rb. Как то так:
class ApplicationController < ActionController::Base
helper_method :current_user
def current_user
@current_user ||= session[:user_id] ? User.find(session[:user_id]) : User.new
end
end
Возможно, вам придется все это настроить, так как это будет зависеть от того, как настроены ваши модели. Это всего лишь общее представление о том, что вам нужно / нужно делать.