Reputation: 167
I need to display dynamical charts based on user's choises. I want to let the user choose options from several select menus filled by data coming from db tables. When the user submit the page, I want to fire a query in order to get the data to build my charts with.
I'm new to Rails and I cannot figure out how to do this.
I've made a new model, setting it to "Abstract" (as I don't need to write anything to the db, just display query results) but I don't know which action I have to use (index, new etc.).
I hope I had correctly explained the problem.
Thank you
Upvotes: 0
Views: 723
Reputation: 169
Looking at your problem in your views you can use form_tag
with remote: true
option and url
set to your index action. Add your business logic to return chart data in index action. remote: true
option will fire request asynchronously. In your views use returned data to display chart.
Upvotes: 2