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
|
||||
|
||||
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,
|
||||
length: { maximum: 100 },
|
||||
uniqueness: true
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<nav>
|
||||
<ul>
|
||||
<% if logged_in? %>
|
||||
<li><%= link_to t(".tables"), tables_path %></li>
|
||||
<li><%= link_to t("log_out"), logout_path, data: {turbo_method: :delete} %></li>
|
||||
<% if Current.user.admin? %>
|
||||
<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.
|
||||
edit: Edit
|
||||
delete: Delete
|
||||
errors:
|
||||
unique_table_name: you already have a table with that name
|
||||
layouts:
|
||||
admin:
|
||||
dashboard: Dashboard
|
||||
game_systems: Game Systems
|
||||
application:
|
||||
tables: Tables
|
||||
mailer:
|
||||
greeting: "Hello, %{name}"
|
||||
sign_off: |
|
||||
|
|
Loading…
Reference in New Issue