vendredi 19 juin 2015

Print variables coming to model's methods

Having following code:

 class MyModel < ActiveRecord::Base

     before_create :do_process

     def do_process
         #I want to print here everything that came to this method 
         self.my_stuff = my_stuff
     end

Say we have model with name and description attributes and I'm going into console and enter something like

MyModel.create! name: 'test', description: 'test'

So how can I view what arguments passed to method do_process?

Aucun commentaire:

Enregistrer un commentaire