def show
email = UserEmail.find_by_key(UserEmail.key_for(UserEmail.new(:publisher_id => @publisher.name, :app_id => @app ? @app.name : 'none', :external_uid => @user.external_uid)))
respond_to do |format|
format.xml { render :xml => @user.to_xml(:session => false, :authorized => user_logged_in? || publisher_logged_in? || app_logged_in?, :publisher => @publisher, :email => email || false) }
format.json { render :json => @user.to_json(:session => false, :authorized => user_logged_in? || publisher_logged_in? || app_logged_in?, :publisher => @publisher, :email => email || false) }
end
end
这是我的代码,我特别想了解以下内容:
format.json { render :json => @user.to_json(:session => false, :authorized => user_logged_in? || publisher_logged_in? || app_logged_in?, :publisher => @publisher, :email => email || false) }
答案 0 :(得分:0)
to_json
唯一可以理解的参数是:only
,:except
,:methods
和:include
(请查看文档here)。
如果您的to_json
使用其他参数,那是因为它(或方法as_json
)已在模型中被覆盖。