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
defmodule MyApp.Model.Project do | |
import Ecto.Query | |
alias MyApp.Repo | |
def user_projects_by_name do | |
query = | |
from project in Project, | |
join: project_user in ProjectUser, | |
on: project.id == project_user.project_id, | |
join: user in User, |
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
defmodule MyApp.Schema.Project do | |
use Ecto.Schema | |
alias MyApp.Schema.User | |
alias MyApp.Schema.ProjectUser | |
schema "projects" do | |
many_to_many :users, User, join_through: ProjectUser | |
end | |
end |
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
SELECT * FROM orders | |
INNER JOIN customers | |
ON customers.id = orders.customer_id |
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
defmodule DiscussWeb.Router do | |
use DiscussWeb, :router | |
pipeline :browser do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_flash | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers | |
end |
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 TopicsController < ApplicationController | |
before_action :find_topic, only: [:edit, :update, :destroy] | |
def index | |
@topics = Topic.all | |
end | |
def new | |
@topic = Topic.new | |
end |
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
Rails.application.routes.draw do | |
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html | |
resources :topics | |
end |
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
<div class="form-group row "> | |
<%= textarea_input f, :description, nil, is_horizontal: true, class: "invisible", description: "desc.", rows: "10" %> | |
</div> |
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
<script> | |
ClassicEditor | |
.create( document.querySelector( '#product_description' ), { | |
removePlugins: [ 'ImageUpload', 'MediaEmbed' ] | |
} ) | |
.catch( error => { | |
console.error( error ); | |
} ); | |
</script> |
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
<div class="form-group row "> | |
<%= textarea_input f, :description, nil, is_horizontal: true, description: "desc.", rows: "10" %> | |
</div> | |
<script> | |
ClassicEditor | |
.create( document.querySelector( '#product_description' ) ) | |
.catch( error => { | |
console.error( error ); | |
} ); |
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
<script src="https://cdn.ckeditor.com/4.11.1/standard/ckeditor.js"></script> |
NewerOlder