Multiline input

Hi

Supposing i have a table Employees as follows

id | Name | Age | Salary |

and use scaffold while generating model, view and controller by the
command.

ruby script/generate scaffold Employee

When I go to the new entry page by choosing

http://localhost:3000/Employees/new

I get a form with 3 fields after entering which and pressing submit
buttons the entries are submitted to the database.

I i have to add one more entry i have to again press on new link and
again enter them followed by pressing submit button. I will have to
repeat the process 100 times if i have to enter hundred records.

Instead
can I have multiple rows of input, so that i can enter all of them and
press a single submit button, after which all the entries are submitted
to the database?

Please let me know the approach i need to follow to achive this.

Thnaks
Prasanna

It’s possible to enter multiple rows of input. Check into using the
array notation for your object (e.g., ‘users[]’).

However, I’d think through whether that makes sense in this particular
case. You may have 100 users to add initially and that might be a
bit annoying, but is the “add a user” use case going to be used for
multiple user entries very often? It sounds like an edge case.

On May 19, 8:46 am, Prasanna kumar Nagasamudram <rails-mailing-

AndyV wrote:

It’s possible to enter multiple rows of input. Check into using the
array notation for your object (e.g., ‘users[]’).

However, I’d think through whether that makes sense in this particular
case. You may have 100 users to add initially and that might be a
bit annoying, but is the “add a user” use case going to be used for
multiple user entries very often? It sounds like an edge case.

On May 19, 8:46 am, Prasanna kumar Nagasamudram <rails-mailing-

Thanks for the response Andy.

Well im tying to devolop an application which simulates a time
sheet(status report).

Where user may have to enter multiple rows of data.
Say for example
Project1 task1 10hrs
Project1 task2 20hrs
Project3 task1 5 hrs
etc.
and press submit button.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs