Jump to content

The ultimate community for Ruby on Rails developers.


Code smell and duplication

  • Please log in to reply
No replies to this topic

#1 Ohm



  • Moderators
  • 529 posts
  • LocationCopenhagen

Posted 27 August 2013 - 09:09 AM

When running my small app through CodeClimate I get a lot of duplication warnings, however I am not sure how to do this in a better way.


Link: https://codeclimate....atorsController

respond_to do |format|
  if @administrator.save
    format.html { redirect_to administrators_path, notice: 'Administratoren blev oprettet.' }
    format.json { render action: 'show', status: :created, location: @administrator }
    format.html { render action: 'new' }
    format.json { render json: @administrator.errors, status: :unprocessable_entity }

It highlights a lot of these in my controllers and tells me it is duplication. How should I do it without duplication?

  • james likes this

Blog: http://ohm.sh | Twitter: @madsohm | Work: Lokalebasen.dk

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users