Resting Pug logo Resting Pug

Description

Updates a subject

Tip

Override this method to add some custom logic to updating process.

Used in

Use

Example

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a update_subject to update only if title is not 'None'
  def update_subject
    @subject.update(params_for_update) unless params_for_update[:title] == 'None'
  end
end

Source code

# lib/resting_pug/subject.rb

def update_subject
  @subject.update(params_for_update)
end
Find me on GitHub