On 15 December 2015 at 11:44, Kacper Migala <[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?<br>
> 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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtM94hFMbo3nX2E32scVp74M2gZ-LNFqNNBiUx06xcGwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to