mardi 3 janvier 2017

Where do I put in a custom rails method with paramaters and math?

I have a custom method I made in ruby that I'm hoping to put into my rails app.

You can test it out here: https://repl.it/Ezqr/20

def time_clock(hour, min)
...
end

I also have a rails app with a simple scaffold. The scaffold I ran was

rails g scaffold Timeclock hour_in:integer minutes_in:integer

I would like to be able to put my custom time_clock method into my rails app and see it in the view. But where does the method go? Or at least how am I supposed to implement it into my rails app? does it go into the controller or the model?...help!

Aucun commentaire:

Enregistrer un commentaire