I'm totally confused - I have 3 tables
search, pickup_search and dropoff_search
pickup_search and dropoff_search are nearly identical and each contain
the search_id key.
My Models are as follows.
class Search < ActiveRecord::Base
class PickupSearch < ActiveRecord::Base
class DropoffSearch < ActiveRecord::Base
So what I want to do is create a new search, then a new pickup_search
and a new dropoff_search.
I tried in my controllers new method to do
@search = Search.new
however it throws the error when creating a new pickup and dropoff
NoMethodError (You have a nil object when you didn't expect it!
However if I change the relationship in search to has_many it works!!!
However for any given 'search' there will only be one pickup_search and
dropoff_Search so it shouldn't be a has_many relationship... or am I
modelling this incorrectly
(FYI the pickup_search and dropoff_date contains date/destination info)
Any help much appreciated!