My own active record for rails!
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Austen Record

Welcome to the Austen Record documentation. Austen Record is a rub library for doing SQL database queries. This can be used in a similar way to Active Record that is implemanted natively in the Rails framework.

Class Methods

The SQL object class has several class methods. For example we assume we create a Book class that inherits from the SQLobject class.


  • returns all instanes of that SQL object.

  • Example: Book.all() would return all instances of Book in the database, i.e. all columns with all row information.


  • returns an instance of an SQL object with the given id

  • Example: Book.find(2) would find the Book from the SQL table with id 2.


  • equivalent to doing an SQL querry using "WHERE", where the params passed in the params hash are the limiting factors.

  • Example: Book.where({title: "Our Mutual Friend"}) returns all book instances where the title is "Our Mutual Friend" Book.where({author: "Dickens"}) returns all book instances where the author is "Dickens"



  • this creates a new instance of the class, passing it the params necessary to create the object. This does not save the instance to the database.
  • Example: new_book ={title: "The Lord of the Rings", author: "J.R.R. Tolkien", genre: "fantasy"}), this would create a Book instance, but would not save it to the database unless was called.


  • saves the book to the database
  • would save the instance new_book to the data base


  • takes an existing book object and updates according to new params.
book_to_change = Book.where({title:"Lord of the Rings"})[0] #finds the appropriate book
new_params= {genre: "High Fantasy"} #the paramaters I want to change about the book
book_to_change.update(new_params) #updates the database to appropriate values