-
object type and flash
Hello buddies, I have a page that works with several models (type1, type2, type3) with STI. When I save a object I would like to have a feedback message on my flash.
How can I catch the model type in order to show the name.
For instance when I save a type1 object the message should be "type1 has been saved" and when I save a type2 object the message should be "type1 has been saved" .
Something like
Code:
@type.save
flash[:notice]=@type.name+"has been saved"
Thanks
-
If I understand you correctly, you want to show the class name for the object?
Code:
flash[:notice] = "#{@type.class} has been saved"