Displaying 1 result from an estimated 1 matches for "puzzlescontroller".
2007 May 22
3
Comments wanted about spec''ing out a couple controller methods
...Could someone help me spec out these Rails controller methods? I
don''t know where to get started, especially with the transaction
stuff. Or, if anyone else could suggest ways I could improve the
code, that would be great as well.
Puzzle has_one Media. Both are AR model objects.
class PuzzlesController < ApplicationController
# a before_filter fills in @user
def create
@puzzle = Puzzle.new(params[:puzzle])
@puzzle.user = @user
@media = Media.new(:uploaded_data => params[:media])
Puzzle.transaction do
@puzzle.media = @media
@puzzle.save! && @media.save!...