RailsCasts Pro episodes are now free!

Learn more or hide this

R|S|L's Profile

GitHub User: Ricardosluiz

Comments by R|S|L

Avatar

Rails 4

ruby
def category_name=(name)
          self.category = Category.where(name: name).first_or_create if name.present?
  end