Either I’m missing something here, or you really don’t assign a project
to
the line. The params[:line] you’re using to create a new Line doesn’t
include a project.
I don’t know how you’re interface is set up, but either include a field
for
the project (usually a select), or add “@line.project = @project”
between
the save and new statements of the line.
There is no need for the @project and @lines variables in the
create_lines
method to be isntances variables BTW. You can remove the @'s.
Either I’m missing something here, or you really don’t assign a project
to
the line. The params[:line] you’re using to create a new Line doesn’t
include a project.
I don’t know how you’re interface is set up, but either include a field
for
the project (usually a select), or add “@line.project = @project”
between
the save and new statements of the line.
Beautiful - that did the trick. Pretty obvious, it seems now
There is no need for the @project and @lines variables in the
create_lines
method to be isntances variables BTW. You can remove the @'s.
That makes sense, thanks.
However, I still seem to have issues inserting the rows. As you can see
from my code snippets, I’d like to insert several line items…
The object “line” is a parameter of a block (is that called a parameter?
The
thing between |'s?) for example, when iterating over a collection of
lines.
This way, you can store a collection of fields in a hash, which you can
unpack
again in your controller.
I know this may be of little help, but as I said, it’s going to be a
little
difficult to explain. Also, I’d need more info on your app to give
accurate
help, but that would most likely mean a lot of work for me. I do need
time to
work on my own app, you see
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.