render @some_object
will render Rails.root/app/views/some_objects/_some_object.html.erb
Now I want to handle which partial will be rendered depends on its data_type field. For example:
class SomeObject < AR::Base
# some magick method wich I need to rewrite
def partial_name
case data_type
when "String"
"string_template"
when "Text"
"text_template"
else
"blank_template"
end
end
end
I know there is model_name, i18n_key and some others, which are returnes model name, but which one is used in my render @object case?
EDIT
Now I’ve stopped on the easiest solution that didn’t touch models. I removed all this logic into _some_object.html.erb partial, so it renders partial I need inside of itself:
<div class='claim_template_field'>
<%= render "/some_objects/#{f.object.data_type.downcase}_template", :f => f %>
</div>
Now I’ve stopped on the easiest solution that didn’t touch models. I removed all this logic into _some_object.html.erb partial, so it renders partial I need inside of itself: