我正在基于angularjs和rails的单页应用程序。我使用RABL来呈现JSON文件。 很多JSON响应需要这样的 child :tags do
attributes :id, :name
end
child webapp.comments do |t|
// with other nested attributs like user fo
使用Rspec,我试图为我的API创建一个控制器规范,以及请求规范。问题是我不明白在每个规范中测试的部分内容。 为简单起见,假设我的控制器看起来像如下: class Api::V1::ItemsController < ApplicationController
def index
if params[:user_id]
user = User.find(param
另一种模式我有3种型号: class City < ActiveRecord::Base
has_many :buildings
end
class Company < ActiveRecord::Base
has_many :buildings
end
class Building < ActiveRecord::Base
belongs_to :city