That looks fine to me. If the setup was any more complicated you might want to pull it into a method, but there's only one line so for now that's not really necessary.

Some people do like to avoid calling self. when it is not necessary.

> On Mar 14, 2014, at 17:49, tobyk100 <notifications@github.com> wrote:
> 
> In app/controllers/levels_controller.rb:
> 
> >    def update
> > -    respond_to do |format|
> > -      if @level.update(level_params)
> > -        format.html { redirect_to [@level.game, @level], notice: I18n.t('crud.updated', Level.model_name.human) }
> > -        format.json { head :no_content }
> > -      else
> > -        format.html { render action: 'edit' }
> > -        format.json { render json: @level.errors, status: :unprocessable_entity }
> > -      end
> > +    if @level.update(level_params)
> > +      redirect_to [@level.game, @level], notice: I18n.t('crud.updated', Level.model_name.human)
> > +    else
> > +      self.edit
> > +      render 'edit'
> Is there a better way to do this? I can't do a redirect because then I lose error messages but I don't want to repeat setup from the edit action.
> 
> —
> Reply to this email directly or view it on GitHub.