I recently finished my project called: http://www.brau-brett.de I wasn't aware of the possibilities on how to create just a basic search function within my jobs database. I've found a neat little tutorial on how to do it without using any gem but raw sql. I started by impelmenting a searchfield into the index jobs index … Continue reading Raw SQL for search bar
SQL is a programming language used for relational databases. To menage them and perform various operations on the data, such as adding, updating and deleting rows of data in the database or retrieving information. Commonly used SQL statements are: select, add, insert, update, delete, alter and truncate. A relational database is a set … Continue reading What is SQL?
Strategies when creating a new gem: add a module to application_controller.rb think about from where the gem should be called from with the code above I'm going to implement a copyright that shows on all of my pages, I just have to call it with and voila I got what I wanted: … Continue reading Building my first little Ruby gem
What is Action View? "In Rails, web requests are handled by Action Controller and Action View. Typically, Action Controller is concerned with communicating with the database and performing CRUD actions where necessary. Action View is then responsible for compiling the response." "To avoid cluttering the templates with boilerplate code, a number of helper classes … Continue reading Deep Dive ActionView
I've recently watched a short video about github and the use of Markdown. Since WordPress supports the use of markdown i decided to get used to it for this blog but also for GitHub, example: ReadMe.md, where md stands for markdown. Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using … Continue reading Introduction to Markdown
Next on our list: controller. class TodosController < ApplicationController before_action :set_todo, only: [:show, :update, :destroy] # GET /todos def index @todos = Todo.all json_response(@todos) end # POST /todos def create @todo = Todo.create!(todo_params) json_response(@todo, :created) end # GET /todos/:id def show json_response(@todo) end # PUT /todos/:id def update @todo.update(todo_params) head :no_content end # DELETE /todos/:id … Continue reading Build a TDD RESTful JSON TODO-List API (pt.3)
Fixing the failures ...by editing our two models: /app/models/todo.rb # app/models/todo.rb class Todo < ApplicationRecord # model association has_many :items, dependent: :destroy # validations validates_presence_of :title, :created_by end app/models/item.rb class Item < ApplicationRecord belongs_to :todo # validation validates_presence_of :name end running bundle exec rspec again will result in 0 errors as expected: Finished in … Continue reading Build a TDD RESTful JSON TODO-List API (pt.2)