Skip to content

Example rails application with installed Rick-And-Morty gem and a few queried endpoints

Notifications You must be signed in to change notification settings

spielhoelle/rick-and-morty-gem-examle-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rick and Morty ruby gem example implementation

This is a example Ruby on Rails app which makes use of the ruby client gem implementation for the fantastic Rick & Morty Api by Afuh

Installation

  1. git clone https://github.com/spielhoelle/rick-and-morty-gem-examle-app
  2. cd rick-and-morty-gem-examle-app
  3. bundle install
  4. bundle exec rails server

open localhost:3000 to see all the queried endpoints in the frontend.

Example queries in the WelcomeController:

class WelcomeController < ApplicationController
  protect_from_forgery with: :exception
  def index
    @all_episodes = Rickmorty::Episode.new.all
    @all_characters = Rickmorty::Character.new.all
    @all_locations = Rickmorty::Location.new.all

    @rick = Rickmorty::Character.new.by_id(1)
    @morty = Rickmorty::Character.new.by_id(2)
  end
end

About

Example rails application with installed Rick-And-Morty gem and a few queried endpoints

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published