Reputation: 20445
I have a Post object that I would like to save to session[:post].
In my Post.rb, I have:
class Post < ActiveRecord::Base
validates :link, presence: true, url: true
I would like to use this validation before I save my post object to session (not database). Is there a way to do that?
Thank you.
Upvotes: 0
Views: 553
Reputation: 3371
Call the method post.valid?
on your object before saving it into your session ?
Upvotes: 1