Skip to content

Commit

Permalink
delete fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lisovskey committed May 30, 2018
1 parent 49f4869 commit 9cd3312
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
7 changes: 3 additions & 4 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ class Project < ApplicationRecord

mount_uploader :avatar, AvatarUploader


belongs_to :user
belongs_to :category
has_many :choices
has_many :donations
has_many :rewards
has_many :choices, dependent: :destroy
has_many :donations, dependent: :destroy
has_many :rewards, dependent: :destroy

accepts_nested_attributes_for :rewards, allow_destroy: true

Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class User < ApplicationRecord
devise :database_authenticatable, :registerable, :recoverable,
:rememberable, :validatable, :confirmable, :lockable

has_many :projects
has_many :projects, dependent: :destroy
has_one :validation

validates_presence_of :email, :encrypted_password, :first_name, :last_name, :wallet
Expand Down
8 changes: 1 addition & 7 deletions app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,12 @@
</div>
</div>

<div class="row">
<div class="row fix">
<div class="col s12">
<%= f.button t('.update'), class: "full-width waves-effect waves-light btn-large", data: {disable_with: I18n.t("form.wait")} %>
</div>
</div>
<% end %>

<div class="row fix">
<div class="col s12 center-align">
<%= button_to t('.destroy'), registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "waves-effect btn-flat" %>
</div>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 9cd3312

Please sign in to comment.