# How to avoid components?

**URL:** <https://www.ruby-forum.com/t/how-to-avoid-components/118959>\
**Category:** Rails\
**Created:** [November 1, 2007, 7:01pm UTC](https://www.ruby-forum.com/t/how-to-avoid-components/118959 "2007-11-01T19:01:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rehevkor5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e8cbc/32.png) [@rehevkor5](https://www.ruby-forum.com/u/rehevkor5)\
**Post date:** [November 1, 2007, 7:01pm UTC](https://www.ruby-forum.com/t/how-to-avoid-components/118959/1 "2007-11-01T19:01:58Z")

</div>

I’ve seen this asked once asked before, but I haven’t seen a good  
response. If components are “bad” how does one avoid using them?

I have a list of items on a page. Each item can be one of two types.  
We don’t know which type the item is until the user selects it and  
submits. If it’s type 1, the info loads in an AJAX page from the same  
controller. If it’s type 2, the controller redirects to a different  
controller which then loads into the AJAX area.

Now, I am trying to get the page to load the last selected item  
immediately without AJAX when it is first visited. Obviously, I can  
no longer redirect in the same way. Therefore I have to either call  
the other controller’s action as a component, or combine the logic  
from both controllers into one which gets the right data and renders  
the correct partials. However, I do not want to combine the logic  
from both controllers.

How should I solve this problem then?
