On 19 February 2015 at 08:44, Maarten Van Essen <li...@ruby-forum.com> wrote:
> I am a beginner in Ruby on Rails.
>
> I would like to make the following database model:
>
> Package (has_many packagelines)
>   Packageline (belongs_to package)
>
> The package line can be one of 3 things: entity, item or service, so I
> would like to have a line type with the options entity, item or service.
> I also want a field where I store the foreign key. The problem is that
> the foreign key is dependent on what is selected in the line type field.

Before you attempt to solve such issues I would make sure you have a
good understanding of the basics of Rails, as you may well decide the
above is not the best way to solve the problem.  I suggest you first
work right through a good tutorial such as railstutorial.org (which is
free to use online) including doing all the exercises.  Then
reconsider your problem and come back with further questions if
necessary.

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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLueeo_xig_7n%3DymdVaRpwkDzYK0bjqpa7dWNUJvMLy8hg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to