Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
parent table = cars related table = parts c = car.find_by_id(1) c.part.new(:car_id => 1, :part_name => "gas pedal", :color => "black")
我不能让它工作。
我怎样才能做到这一点?我如何找到可以用于这种关系的方法?
你可以这样做
c = Car.find_by_id(1) c.parts.create(:part_name => "gas pedal", :color => "black")
我假设您定义了汽车 has_many 零件关系。
为大型数据集构建 UI。理想的情况是有一个固定高度的表格,该表格可滚动以容纳 200 多行数据。一个好处是使用 JQuery UI 使用户能够拖动表格的高度以显示更多或更少的行。
到目前为止我所拥有的 JSFiddle:http: //jsfiddle.net/jonbrownm/j5