the problem I’m having is company_id is not been save to the details table
I know the company_id is there I check it using <%= debug(params[:id])%> on the form before adding all company details information but for some reason is saving everything else but the company_id
##user.rb
has_one :company
##company.rb
belongs_to :user
has_one :detail
##detail.rb
belongs_to :user
##details controller
def new
@detail = Detail.new
user_id = session[:user_id]
company_id = params[:id]
end
def create
@detail = Detail.new(params[:detail])
@detail.user_id = session[:user_id]
@detail.company_id = params[:id]
end
###settings.html.erb
### this is where i make sure that company_id gets pass with the url
link_to 'New Detail', {:controller => 'details', :action =>'new', :id => company.id }, :class => 'plus'
#####routes
resources :details
resources :companies
resources :users
resources :sessions
I know this may not look pretty or proper if you know a better way please let me know…thanks in advance.
I didn’t realize this until later but I need it pass values to from on the view to the from like so
and I need it to collect that value on the from…like so