This post is a two part post, I apologize for the length.
So far I have been able to wrap my brain around RoR fairly well. But
this certain scenario, which I do plan to make use of quite a bit, has
me a little stumped.
Currently in my application I have a view setup named
dashboard.html.erb. This view requires a high level of customization
by the user, they will need to have the ability to add and remove
"widgets"(partials) as they see fit. These partials are not designed
to use data from the dashboard controller.
My first question is, what would be the best practice way to get data
into these partials? My initial thought was to use a ajax get request
for each partial that is being displayed, however this seems like
unnecessary overhead.
My second question is, when using a controller that does not require a
specific view, but instead returns json data, what are the best
practices for creating this controller action?
This post is a two part post, I apologize for the length.
So far I have been able to wrap my brain around RoR fairly well. But
this certain scenario, which I do plan to make use of quite a bit, has
me a little stumped.
Currently in my application I have a view setup named
dashboard.html.erb. This view requires a high level of customization
by the user, they will need to have the ability to add and remove
"widgets"(partials) as they see fit. These partials are not designed
to use data from the dashboard controller.
My first question is, what would be the best practice way to get data
into these partials? My initial thought was to use a ajax get request
for each partial that is being displayed, however this seems like
unnecessary overhead.
I would use a before_filter in the controller to populate the data for
the partials.
My second question is, when using a controller that does not require a
specific view, but instead returns json data, what are the best
practices for creating this controller action?
I don't understand the question, what do you mean by "creating the
controller action"?