-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- association between users and contacts
- Loading branch information
Showing
9 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,11 @@ label.required:after { | |
content: " *"; | ||
color: red; | ||
} | ||
|
||
.form-inline { | ||
.form-group { | ||
input { | ||
width: 100%; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
class Flows::ContactsController < ApplicationController | ||
def index | ||
# sdcscsdcs | ||
# @newsletters = current_user.newsletters.order(id: :asc) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Contact < ApplicationRecord | ||
self.table_name = 'users' | ||
|
||
has_and_belongs_to_many :users, join_table: :users_contacts | ||
|
||
validates :name, :email, presence: true, length: { maximum: 255 } | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
- %w(Иван Федор Джордж Санта Камбэл Джинна Марина Инна).each do |name| | ||
tr | ||
td= rand(10) | ||
td= link_to name, flow_path(id: :contact) | ||
td= "#{name}@mail.ru" | ||
td= rand(10) | ||
td= rand(10) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
h1 Мои Контакты | ||
|
||
.panel.panel-success | ||
.panel-body | ||
form.form-inline | ||
.form-group.col-lg-5 | ||
input placeholder="Имя" class="form-control" | ||
.form-group.col-lg-5 | ||
input placeholder="E-mail" class="form-control" | ||
.form-group.col-lg-2 | ||
button class="btn btn-success" Добавить | ||
|
||
table.table.table-hover.table-striped | ||
tr | ||
th ID | ||
th Имя | ||
th E-mail | ||
th Кол-во подписок | ||
th Кол-во отписанных | ||
= render 'contact' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CreateUsersContacts < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :users_contacts, id: false do |t| | ||
t.belongs_to :user, index: true | ||
t.belongs_to :contact, index: true | ||
end | ||
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