Ruby on Rails, continuously check condition to render different partials -


so have question.

just little background problem: i'm working on web application whereby users can plug arduino's pc's , feed live data application via http posts. data gets rendered highcharts realtime graph form user share. thats , working.

however, on profile page user sees shared graph in realtime motion, either render documentation on how start posting data (if user has not posted yet) or graph (if user has posted data either or in past).

my original solution check:

//if there arduino datapoints saved in database means user has posted data in past he/she not need see documentation on how post data      if @data_points.any? == true     render partial: "sensors/sensor", locals: {token: @dashboard.token, sensor: @sensor.name}  //or else render documentation else     render partial 'documentation' end 

now question is, using solution, if documentation partial gets rendered initially, how put dynamic listener render graphs (sensors) partial , replace documentation partial when detects there data in database? maybe while loop of sorts?


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -