Add unique table names per-user
This commit is contained in:
parent
3ce9081996
commit
c6072a4cb7
|
@ -5,7 +5,8 @@ class Table < ApplicationRecord
|
||||||
belongs_to :game_system
|
belongs_to :game_system
|
||||||
|
|
||||||
validates :name, presence: true,
|
validates :name, presence: true,
|
||||||
length: { maximum: 100 }
|
length: { maximum: 100 },
|
||||||
|
uniqueness: { scope: :owner_id, message: I18n.t("errors.unique_table_name") }
|
||||||
validates :slug, presence: true,
|
validates :slug, presence: true,
|
||||||
length: { maximum: 100 },
|
length: { maximum: 100 },
|
||||||
uniqueness: true
|
uniqueness: true
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<% if logged_in? %>
|
<% if logged_in? %>
|
||||||
|
<li><%= link_to t(".tables"), tables_path %></li>
|
||||||
<li><%= link_to t("log_out"), logout_path, data: {turbo_method: :delete} %></li>
|
<li><%= link_to t("log_out"), logout_path, data: {turbo_method: :delete} %></li>
|
||||||
<% if Current.user.admin? %>
|
<% if Current.user.admin? %>
|
||||||
<li><%= link_to t("administration"), admin_index_path %></li>
|
<li><%= link_to t("administration"), admin_index_path %></li>
|
||||||
|
|
|
@ -7,10 +7,14 @@ en:
|
||||||
not_authenticated: You need to log in to access this page.
|
not_authenticated: You need to log in to access this page.
|
||||||
edit: Edit
|
edit: Edit
|
||||||
delete: Delete
|
delete: Delete
|
||||||
|
errors:
|
||||||
|
unique_table_name: you already have a table with that name
|
||||||
layouts:
|
layouts:
|
||||||
admin:
|
admin:
|
||||||
dashboard: Dashboard
|
dashboard: Dashboard
|
||||||
game_systems: Game Systems
|
game_systems: Game Systems
|
||||||
|
application:
|
||||||
|
tables: Tables
|
||||||
mailer:
|
mailer:
|
||||||
greeting: "Hello, %{name}"
|
greeting: "Hello, %{name}"
|
||||||
sign_off: |
|
sign_off: |
|
||||||
|
|
Loading…
Reference in New Issue