Technical Tuesdays: Using GraphQL, a Ruby on Rails introduction

{
allMovies {
title
description
}
}
gem install bundler
gem install rails
bundle installrails new learning-graphql
rails db:create
bundle installrails generate graphql:installbundle install
rails generate model movie title description
rails db:migrate
Movie.create(
title: ‘Deadly Weapon’,
description: ‘2 retired monks walk into a bar’
)

Movie.create(
title: ‘Deadly Weapon 2 — This time time it’s personal’,
description: ‘Like Deadly Weapon, only deadlier and more personal’
)
rails generate graphql:object movie
{
allMovies {
id
title
description
}
}
{
movie(id: 2) {
id
title
}
}

Creating a Movie

mutation {
createMovie(title: “Deadly Weapon 3”, description: “Even deadlier!”) {
id
}
}
rails generate model review content movie_belongs_to
rails db:migrate
rails generate graphql:object review

Proceeding Further

Want to build some magic together?

--

--

We are an incubator and consultancy specializing in software, tech, automation, AI, and retail businesses.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Unicorn

We are an incubator and consultancy specializing in software, tech, automation, AI, and retail businesses.