last day (14 days later) » 

6:32 AM
0
Q: how to do not allow particular user to give rating using ratyrate gem

ashvinI am using ratyrate gem for rating in my rails application. there is user who can purchase or sell his books. but User can not rate his own book(Uploaded by same user). and when i reload page then only it show rating. how to show rating on button click without reload..... User model. class User <

 
SSR
Please paste some code that you did.
Not getting you by your comment. will you elaborate?
When you click on rate start to give rating. please paste that log. which action and controller is being execute.
 
ignore comment. below i mention I want to restrict user to can not give rating to his books, he can only see rating
 
SSR
Let me create a room where I can help you out
 
Processing by RaterController#create as / Parameters: {"score"=>"1.3271484375", "dimension"=>"price_for_sale", "id"=>"250", "klass"=>"Book"}
 
SSR
paste your method
 
6:32 AM
can we continue in skype??
 
SSR
Hi
 
hi
 
SSR
Great
Now lets discuss here
Tara ma controller che?
and eni method che?
 
je user book upload kare e rating na api sake
 
SSR
Ha hu samji gyo
 
6:34 AM
class RaterController < ApplicationController

def create
if user_signed_in?
obj = params[:klass].classify.constantize.find(params[:id])
obj.rate params[:score].to_f, current_user, params[:dimension]

render :json => true
else
render :json => false
end
end
end
 
SSR
me taro question update karyo etlej
 
hmm
 
SSR
Okay wait
obj ma tane su malse?
Book?
Tare simple condition marva ni che
 
wait checking??
 
SSR
Okay
Mane obj.user.id logger kari ap
And please remove comment from your question. skyp wadi comment :)
 
6:37 AM
ha e remove kari didhi
obj ma book detail male 6
 
SSR
Okay have obj.user.id kar
 
ok
 
SSR
User malyo?
User Id malse
 
ha
 
SSR
Okay thai gyu
if obj.user.id == current_user.id
 
6:39 AM
to e rating joi sakse
 
SSR
alert = "You can not rate your own book"
else
obj.rate params[:score].to_f, current_user, params[:dimension]
end
Evu na karay
 
to e rating par click karse etle alert avse ne
 
SSR
ha but for that you should create ajax
Banavi apu?
 
ok getting
 
SSR
See heart hase and eni niche total rating show karvanij
badha user mate same
 
6:41 AM
ha rite alert ma nai ave
 
SSR
su?
syntax proper nathi mari
 
flash thi
 
SSR
me just logic mukyu
 
?
 
SSR
Atlu kar and check kar k work kare che k nai
pachi tane hu ajax karavis
Su kare che badha :)
 
6:43 AM
bas project nu kam j
 
SSR
Saras.
 
ok i check karu
gr8 idea saro apyo 6, me aa rite vicharyu hatu pan mare rating khali show j karvu hatu pan aa way pan sacho 6
thnks
 
SSR
Are thanks na hooy :)
Khali khali na keto ho :D use karva no hoy to j karje
 
na na check karu j 6u
 
SSR
Okay to bas
Thay etle k j
 
6:47 AM
sure
rating api sake 6 but reload karu tyare j flash msg ave 6, click kare tyare msg nathi avto
 
SSR
Pan rating ni entry nathi padti ne?
 
ha e to nathi padti
 
SSR
Have tare ajax use karva nu che
thai gyu pachi rating vadu
:)
 
ha e thai gayu
 
SSR
Banavi apu?
Su thai gyu?
 
6:52 AM
tamne disturb na thatu hoy to kari apo :)
sorry ajax nathi karyu
 
SSR
Are hu freej chu bhai :)
 
to vandho nai
 
SSR
Tamare sikvu hoy to I will guid you
Tame jate karo to vaddhare saru
 
but kai hint
?
 
SSR
Ha wait apu chu
badha ne share kari deje
 
6:54 AM
ok
 
SSR
Just follow this link
Kyay pan atko to k jo
 
ok
thks
 
SSR
and read for detail ajax in rails
 
ok
 
SSR
So let me ans your question there
 
6:56 AM
sure
 
SSR
and accept it if it is usefull to you
 
ema acount banavu padse ne??
 
SSR
Sema?
 
answer sema accept karu??
 
SSR
Stackoverflow ma
 
7:00 AM
ok
:)
 
SSR
I answer you question see. for you all I attach links there
 

last day (14 days later) »