Ruby on rails 如何在Rails中的控制器中看到show函数在做什么?
我有一个路径是:Ruby on rails 如何在Rails中的控制器中看到show函数在做什么?,ruby-on-rails,Ruby On Rails,我有一个路径是:GET/api/:api_version/publisher/:id(:format){:controller=>“api/publisher”,:action=>“show”} 因此,我打开api中的publisher\u控制器,它看起来: # Provides access to publisher information class Api::PublishersController < Api::BaseResourceController inherit_re
GET/api/:api_version/publisher/:id(:format){:controller=>“api/publisher”,:action=>“show”}
因此,我打开api
中的publisher\u控制器
,它看起来:
# Provides access to publisher information
class Api::PublishersController < Api::BaseResourceController
inherit_resources
respond_to_data_formats
before_filter :find_publisher
before_filter :require_publisher_login, :only => :authenticate
actions :show
# Note: We remove App scope from cache path, since Publisher info should be cached across all apps
caches_action :show, :login, :cache_path => lambda {|c| {:version => c.send(:publisher_version), :model_version => Publisher.cache_config.version}}, :expires_in => 60.seconds
# Action redirects the top frame to the publisher's site (for the user to log in)
def login
# Prevent infinite loop where the page redirects to itself.
raise ArgumentError, 'Publisher website url is not configured' if @publisher.website_url.blank?
end
def authenticate
respond_with(@publisher)
end
private
def find_publisher
params[:publisher_id] = params[:id]
super
end
def publisher_version
@publisher.lock_version
end
end
#提供对发布者信息的访问
类Api::PublisherController:authenticate
行动:表演
#注意:我们从缓存路径中删除应用范围,因为发布者信息应该跨所有应用缓存
caches_action:show,:login,:cache_path=>lambda{c}{:version=>c.send(:publisher_version),:model_version=>publisher.cache_config.version},:expires_in=>60秒
#操作将顶部框架重定向到发布者的站点(供用户登录)
def登录
#防止页面重定向到自身的无限循环。
如果@Publisher.website\u url.blank,则引发ArgumentError,“未配置Publisher网站url”?
结束
def身份验证
用(@publisher)回复
结束
私有的
def find_发布者
params[:publisher_id]=params[:id]
超级的
结束
def发布者版本
@publisher.lock\u版本
结束
结束
没有
show
函数,因此如何查看它的功能?此类继承了show
方法,可能来自Api::BaseResourceController
。如果我不得不打赌的话,我猜Api::BaseResourceController
使用了或类似的东西,这只是假设show
方法应该做一件非常典型的事情:找到记录并使用可用的模板显示它。我想我正在尝试找到该模板。。你知道去哪里找吗?