Dan Ramos
Dan Ramos

Reputation: 1102

Managing partials and components in rails

I'm working on a project that utilizes a dashboard with many different widgets. These widgets are primarily charts. The widgets will interact with many different models and can be called in many different pages and dashboards. Should I create one universal Widget controller and model that handles all of these widgets, or should these widgets be specific to each model? I was thinking the one Widget approach would be better to keep all of the widgets together. If i were to go this route though is there a way I can have the view that calls a partial(widget) run a specific controller method?

For example, I have a show.html.erb file that calls /widget/_orders.html.erb. Whenever this _orders.html.erb partial is called I want it work off of data provided by the 'order' method in the widget_controller.rb. Is there a way to do this, or possibly a better?

Upvotes: 1

Views: 279

Answers (1)

Pawel
Pawel

Reputation: 944

You may be interested in cells project.

Upvotes: 2

Related Questions