This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'rubygems' | |
rescue LoadError | |
end | |
# Requerimos todas las gemas a utilizar aquí: | |
require 'Qt' | |
#require 'gema' | |
#require 'otragema' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Kid | |
include Mongoid::Document | |
has_many :stars # Definimos que el niño puede tener muchas estrellas | |
field :name, type: String | |
# A continuación, definimos un método que nos permita obtener los premios de un niño | |
def prizes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo mongod -f /etc/mongod.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [Mongoid] "ActiveRecord like" CRUD (Create-Read-Update-Destroy) | |
# CREAR POSTS: | |
Post.create(title: "Nuestro Primer Post", content: "Contenido para el primer post") | |
# LEER/ENCONTRAR POSTS: | |
Post.all.to_a # (todos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Auth Example</title> | |
<%= stylesheet_link_tag "application" %> | |
<%= javascript_include_tag "application" %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<div id="container"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def destroy | |
@post = Post.find(params[:id]) | |
@post.destroy | |
redirect_to posts_path, :notice => "Tu post se ha Borrado" | |
end | |
end |