Resting Pug logo Resting Pug

Description

Returns an array with all fields that API can use

Tip

Override this method to add or remove fields that you don’t want API to use.

Used in

Use

Example

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a permitted_fields method to use only :id and :title
  def permitted_fields
    [:id, :title]
  end
end

Source code

# lib/resting_pug/params.rb

def permitted_fields
  subject_model.column_names.map(&:to_sym)
end
Find me on GitHub