0
我有一個letsrate寶石https://github.com/muratguzelletsrate寶石 - 未在提交
我已經安裝了它,並遵循自述頁上的說明創建率。 我已經放置在頁面上:
<div class="shop-review-ratings">
Service: <%= rating_for @shop, "service" %>
Price: <%= rating_for @shop, "price" %>
</div>
但是,當控制器端,我試圖挽救收視率這一行:
@shop.rate(params[:stars], current_user.id, params[:dimension])
它說:
PG::Error: ERROR: null value in column "stars" violates not-null constraint
DETAIL: Failing row contains (24, 3, 1576, Shop, null, null, 2013-06-01 10:13:28.297843, 2013-06-01 10:13:28.297843).
: INSERT INTO "rates" ("created_at", "dimension", "rateable_id", "rateable_type", "rater_id", "stars", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id">
和我的參數說:
{"score"=>"4", "controller"=>"shops", "action"=>"rate"}
我已經運行了所有需要的遷移。而擺shop.rb
下:
letsrate_rateable "service", "price"
有任何人使用這個寶石,並有提示這可怎麼固定的,或者確實有這個寶石的工作例子嗎?