Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In rails, I often have the need to declare a partial that is used across many models. For example, there is a partial where I would like a form wrapped around a button, such that I can just pass in a controller, an action, and an object and that object is sent to that controller's action. Now this is not specific to any of my models. It doesn't seem fitting to declare this partial's file (_processor_button.html.erb) in a model's folder.

What do you suggest is the best place to put this file, and how to call it from there, and do you suggest a totally different way of approaching the example mentioned above?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
203 views
Welcome To Ask or Share your Answers For Others

1 Answer

I store commonly used partials in views/shared/ and call them this way:

render :partial => "/shared/partial_name"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...