Displaying 1 result from an estimated 1 matches for "journalcontrol".
2006 Apr 04
4
Help with many-to-many using :through
...ds
belongs_to :symptoms
end
I have a JournalEntry model that stores foods and symptoms as
comma-seperated strings. Upon record creation in the JournalEntry, I want to
parse the foods and symptoms and create a many to many relationship between
them. I do this like this in the create method in the JournalController
def create
params[:journal_entry]["user_id"] = @session[:user].id
@journal_entry = JournalEntry.new(params[:journal_entry])
if @journal_entry.save
# parse the foods and create a new record if food not already in db
params[:journal_entry]["eat"].spl...