Today I learned to edit my outputs.

I create the template: outputs/edit.mote

It is important to locate the select and change the selected

  • Month: line 8
  • Day: line 13
  • Year: line 20
  • Scale: line 27
  • Duration: line 32 to 37

For example as you can see in the template outputs/new.mote I replace:

Time.now.month => output.date.month

What you’re saying is that instead of putting the current date you must put the date that the user selected.

edit_output


Here I define in my index the link of edit output: is important that in the route the user id is present.

edit_output2


Now we have to go to the route: output.rb

Line 7:
When the route has an id parameter, it matches that block and is passed to it.

On the next line we find the output with that id and assign the output variable.

Date = I am creating a date using the parameters: date_month, date_year and date_day
output = then update the attributes: date, scale and duration.

Once you update your outputs it will redirect you to the initial list of outputs.

edit_output3

You do the same with the inputs.

See the repository:

Inputs
Outputs