Clear ORM
  • Welcome to Clear
  • Introduction
    • Setup
  • Model
    • Defining your model
      • Describing your columns
      • Primary Keys
      • Converters
    • Associations
      • belongs_to
      • has_many
      • has_many through
      • has_one
    • Lifecycle
      • Persistence
      • Validations
      • Triggers
    • Batchs operations
      • Bulk update
      • Bulk insert & delete
    • Transactions & Save Points
      • Transaction & Savepoints
      • Connection pool
    • Locks
  • Querying
    • The collection object
      • Filter the query
        • Filter the query – The Expression Engine
        • Find, First, Last, Offset, Limit
        • Aggregation
        • Ordering & Group by
      • Fetching the query
        • Each and Fetch
        • Cursored fetching
        • Model extra attributes
      • Joins
      • Eager Loading
      • Window and CTE
      • Scopes
    • Writing low-level SQL
      • Select Clause
      • Insert Clause
      • Delete Clause
  • Migrations
    • Manage migrations
    • Call migration script
    • Migration CLI
  • Additional and advanced features
    • JSONB
    • Symbol vs String
    • Enums
    • BCrypt
    • Full Text Search
    • Handling multi-connection
  • Other resources
    • API Documentation
    • Inline documentation
    • Github repository
    • Credits
    • Benchmark
Powered by GitBook
On this page
  1. Additional and advanced features

Symbol vs String

PreviousJSONBNextEnums

Last updated 5 years ago

In most query building methods, we allow symbols and strings to be given as parameter.

While not being always true, when using Symbol, Clear will try to escape the word using double quote during the request building, while String will be printed out as it.

# SELECT * FROM "users" INNER JOIN "orders" on "order_id" == "orders"."id"
User.query.join(:orders){order_id == orders.id }

# SELECT * FROM "users" INNER JOIN orders on "order_id" == "orders"."id"
User.query.join("orders"){order_id == orders.id }

In case of wrong behavior, do not hesitate to .

fill an issue here