Ruby on Rails how to make 3 objects in one view?

This is how my database looks like now:
http://i.stack.imgur.com/CtvQV.png
I want to:

  1. Make in one view customer and ticket.
  2. Display all spots available in seance that user want to by
    ticket
    for.

Is my association between tickets,customers and spot right to do
that?

How I should implement a controller to be able to choose the place and
the
user before creating a ticket ?

On 15 December 2015 at 11:44, Kacper M. [email protected] wrote:

This is how my database looks like now:
http://i.stack.imgur.com/CtvQV.png
I want to:

  1. Make in one view customer and ticket.
  2. Display all spots available in seance that user want to by ticket
    for.

Is my association between tickets,customers and spot right to do that?

How I should implement a controller to be able to choose the place and the
user before creating a ticket ?

Your question is much too vague to give a sensible answer to.

Firstly, though, associations have nothing to do with views and
controllers, so to ask whether your associations are right in order to
make a particular view is meaningless. The tables and associations
must map the real world (whatever that is) in some way. Once you have
those then you can build whatever views you want of the data.

So assuming you are happy with the tables and associations then the
next thing to do is to roughly work out what you want on the view.
Then you just have to work out how to manage the data for the view.
That is the work of the controller.

If you consider the view is mostly about tickets then it should
probably go in the tickets controller, if you think it is mostly about
the customer then put it in the customers controller.

I suggest starting with whatever is the simplest bit of the view.
Then add stuff to it till it does what you want. Don’t forget to
write tests as you go.

When you get stuck on a particular part of the above then ask a
specific question about that part of the problem.

Colin

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