rails_apps_pages 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.textile +4 -0
- data/lib/generators/pages/users/templates/permitted_parameters.rb +8 -0
- data/lib/generators/pages/users/users_generator.rb +11 -2
- data/lib/rails_apps_pages/version.rb +1 -1
- metadata +3 -3
- data/lib/generators/pages/users/templates/registrations_controller.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7f7b2062c44981775c944d658214738a2d5ac1
|
4
|
+
data.tar.gz: 7b2bdcdd33b5f7a128f00aa96e0ef534b271978d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44d6965b93a1e66b630fa6a97b1e582a4bc8b7f63e02721b99d91c1957934e485210eec489489339581781f42e72e25a4ac6e046d629dedb167965ee874ac7d9
|
7
|
+
data.tar.gz: 6142bb9bf917bc5181736a6e0528042c481a6d93b64bdf5408deabfddd86c031beca88ce8d57ecae554b5dda6b527ceae79a0a9622287958f56907fe6d5f908e
|
data/CHANGELOG.textile
CHANGED
@@ -15,12 +15,21 @@ module Pages
|
|
15
15
|
copy_file 'users_controller.rb', 'app/controllers/users_controller.rb'
|
16
16
|
route = ' resources :users'
|
17
17
|
inject_into_file 'config/routes.rb', route + "\n", :after => "devise_for :users\n"
|
18
|
-
copy_file 'registrations_controller.rb', 'app/controllers/registrations_controller.rb'
|
19
|
-
gsub_file 'config/routes.rb', /devise_for :users/, 'devise_for :users, :controllers => {:registrations => "registrations"}'
|
20
18
|
generate 'pages:home -f'
|
21
19
|
copy_file 'visitors/index.html.erb', 'app/views/visitors/index.html.erb'
|
22
20
|
end
|
23
21
|
|
22
|
+
def add_name_field
|
23
|
+
if Object.const_defined?('User')
|
24
|
+
if User.column_names.include? 'name'
|
25
|
+
permitted = File.read(find_in_source_paths('permitted_parameters.rb'))
|
26
|
+
inject_into_file 'app/controllers/application_controller.rb', permitted + "\n", :after => "protect_from_forgery with: :exception\n"
|
27
|
+
prepend_file 'app/views/users/_user.html.erb', "<td><%= user.name %></td>\n"
|
28
|
+
inject_into_file 'app/views/users/show.html.erb', "\n<p>Name: <%= @user.name if @user.name %></p>", :before => "\n<p>Email"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
24
33
|
def add_tests
|
25
34
|
return unless File.exists?('spec/spec_helper.rb')
|
26
35
|
copy_file 'spec/factories/users.rb', 'spec/factories/users.rb'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_apps_pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Kehoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ files:
|
|
67
67
|
- lib/generators/pages/home/templates/home_page_spec.rb
|
68
68
|
- lib/generators/pages/home/templates/index.html.erb
|
69
69
|
- lib/generators/pages/home/templates/visitors_controller.rb
|
70
|
-
- lib/generators/pages/users/templates/
|
70
|
+
- lib/generators/pages/users/templates/permitted_parameters.rb
|
71
71
|
- lib/generators/pages/users/templates/spec/factories/users.rb
|
72
72
|
- lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb
|
73
73
|
- lib/generators/pages/users/templates/spec/features/users/sign_out_spec.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class RegistrationsController < Devise::RegistrationsController
|
2
|
-
before_filter :update_sanitized_params, if: :devise_controller?
|
3
|
-
|
4
|
-
def update_sanitized_params
|
5
|
-
devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}
|
6
|
-
devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation, :current_password)}
|
7
|
-
end
|
8
|
-
|
9
|
-
end
|