I’m having this in my model.
However, the model is used as polymorphic and I want to have different condition.
How can I do code if I’m doing this in controller?
models/comment.rb
validates_length_of :body,
:within => 10..100,
:message => "must be between 10 to 100 characters"
UPDATE:
I only want to use this validation condition when Community model is creating a comment into comment model.
Comment model is polymorphic!
It has commentable_type and commentable_id
No you cann’t do anything like this in controller.
Use condition in your model or put this in community model.