<commit_before>bounce
======

  `bounce` will save and return an active record object. This results in a nice refactor of update and create actions in your controllers when used with`respond_with`.

  Refactor this:

      def create
        article = Article.new(params[:article])
        if article.save
          redirect_to article
        else
          render :new
        end
      end

      def update
        article = Article.find(params[:id])
        if article.update_attributes(params[:article])
          redirect_to article
        else
          render :edit
        end
      end

  Into this:

      respond_to :html

      def create
        article = Article.new(params[:article])
        respond_with article.bounce
      end

      def update
        article = Article.find(params[:id])
        respond_with article.bounce(params[:article])
      end

  If you use Voxdolo's [decent_exposure](https://github.com/voxdolo/decent_exposure) you can do this:

      respond_to :html
      expose(:article)

      def create
        respond_with article.bounce
      end
      alias update create

  If you have more than one controller, I'll bet you do, extract the `respond_to :html` into the application controller. Now this:

      expose(:article)<commit_msg>Refer only to decent_exposure<commit_after>bounce
======

  `bounce` will save and return an active record object. This results in a nice refactor of update and create actions in your controllers when used with`respond_with`.

  Refactor this:

      def create
        article = Article.new(params[:article])
        if article.save
          redirect_to article
        else
          render :new
        end
      end

      def update
        article = Article.find(params[:id])
        if article.update_attributes(params[:article])
          redirect_to article
        else
          render :edit
        end
      end

  Into this:

      respond_to :html

      def create
        article = Article.new(params[:article])
        respond_with article.bounce
      end

      def update
        article = Article.find(params[:id])
        respond_with article.bounce(params[:article])
      end

  If you use [decent_exposure](https://github.com/voxdolo/decent_exposure) you can do this:

      respond_to :html
      expose(:article)

      def create
        respond_with article.bounce
      end
      alias update create

  If you have more than one controller, I'll bet you do, extract the `respond_to :html` into the application controller. Now this:

      expose(:article)
{'fraction_non_alphanumeric': 0.06970404984423675, 'fraction_numerical': 0.0, 'mean_word_length': 2.256020278833967, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5149050', 'n_tokens_mistral': 705, 'n_tokens_neox': 664, 'n_words': 231}