Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Done with user edit/update, index and destroy actions
- Loading branch information
1 parent
4994008
commit 98bcb47
Showing
20 changed files
with
389 additions
and
7 deletions.
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
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ def create | |
render 'new' | ||
else | ||
sign_in user | ||
redirect_to user | ||
redirect_back_or user | ||
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
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
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
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 @@ | ||
<li> | ||
<%= gravatar_for user, :size => 30 %> | ||
<%= link_to user.name, user %> | ||
<% if current_user.admin? %> | ||
| <%= link_to "delete", user, :method => :delete, :confirm => "You sure?", | ||
:title => "Delete #{user.name}" %> | ||
<% end %> | ||
</li> |
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,28 @@ | ||
<h1>Edit user</h1> | ||
|
||
<%= form_for(@user) do |f| %> | ||
<%= render 'shared/error_messages', :object => f.object %> | ||
<div class="field"> | ||
<%= f.label :name %><br /> | ||
<%= f.text_field :name %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :email %><br /> | ||
<%= f.text_field :email %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :password %><br /> | ||
<%= f.password_field :password %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :password_confirmation, "Confirmation" %><br /> | ||
<%= f.password_field :password_confirmation %> | ||
</div> | ||
<div class="actions"> | ||
<%= f.submit "Update" %> | ||
</div> | ||
<% end %> | ||
<div> | ||
<%= gravatar_for @user %> | ||
<a href="http://gravatar.com/emails">change</a> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<h1>All users</h1> | ||
|
||
<%= will_paginate %> | ||
|
||
<ul class="users"> | ||
<%= render @users %> | ||
</ul> | ||
|
||
<%= will_paginate %> |
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,9 @@ | ||
class AddAdminToUsers < ActiveRecord::Migration | ||
def self.up | ||
add_column :users, :admin, :boolean, :default => false | ||
end | ||
|
||
def self.down | ||
remove_column :users, :admin | ||
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
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,22 @@ | ||
require 'faker' | ||
|
||
namespace :db do | ||
desc "Fill database with sample data" | ||
task :populate => :environment do | ||
Rake::Task['db:reset'].invoke | ||
admin = User.create!(:name => "Example User", | ||
:email => "example@railstutorial.org", | ||
:password => "foobar", | ||
:password_confirmation => "foobar") | ||
admin.toggle!(:admin) | ||
99.times do |n| | ||
name = Faker::Name.name | ||
email = "example-#{n+1}@railstutorial.org" | ||
password = "password" | ||
User.create!(:name => name, | ||
:email => email, | ||
:password => password, | ||
:password_confirmation => password) | ||
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
Oops, something went wrong.