I’m building something and I think I’m not going the Rails way with
something. I have two models: ‘seasons’ and ‘episodes’.
has_many :episodes, :dependent => :destroy
map.resources :seasons, :has_many => :episodes
Episodes belong to seasons, so when I want to create a new episode, I
use this path: new_season_episode_path(season). I create a new episode
instance like this:
@season = Season.find(params[:season_id])
@episode = @season.episodes.new
Everything’s going fine, untill I want to save the whole thing. The
form redirects to ‘/episodes’ (no ID). But I have to save the
season_id in the episode.
@show = Show.find( season id? )
@episode = @show.episodes.create(params[:episode])
Anyone suggestions on how to save it and not use hidden fields in the
form (or do I have to?)?
I hope this is clear enough.