acts_as_user 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90bfdd9cb45c244ae3087b564cce23ef6eee4d53
4
- data.tar.gz: 9bf166511ff5cd2d8244b92591b8a4e1b269f79a
3
+ metadata.gz: 7a7e5bcbb549bcaee0d7e66f93759c2bc3061b5d
4
+ data.tar.gz: f4f9c9205329ceb26c70427beecf1d8a72fb1215
5
5
  SHA512:
6
- metadata.gz: 172d296773b4bb9721d48a814f538f7ce3f88fd1e436d99f869ceb6bd04314c8f4f61076d31a8dcd008f2d3ba8ba749abf307e20690111c2d00a45ebdc30d052
7
- data.tar.gz: 770efc66d86120ff5ef8496b322879f7e623c13313407ddfd2f63d1d57938f8328c6bbba837474bc1385599da47a9949a8a812e673e194321f7f3ced0853dbce
6
+ metadata.gz: 5b88ebfdb46ed4f836bb96ad0df2714f76fe286ea2d6e80b73fb4af015b7004c5e6a19134a409a716096eb9e3ff740fef64b0c28bb38404c7c0fdccb74c71c29
7
+ data.tar.gz: 298b5b4a6c8b97cb073bbf38de14d4177f83524340559849b086daaff45a7935d47b8bbf6abb1216c8709d05135cee0f37aa38bf596f39228dbc650679043b03
data/README.md CHANGED
@@ -1,24 +1,74 @@
1
- # ActsAsUser
1
+ #Acts as user
2
2
 
3
- TODO: Write a gem description
3
+ Acts as user handles multiple user roles on a rails app. It uses polymorphic associations to relate other models and behave like a user.
4
4
 
5
- ## Installation
6
5
 
7
- Add this line to your application's Gemfile:
6
+ ## Getting started
8
7
 
9
- gem 'acts_as_user'
8
+ ActsAsUser 1.0.0 works with rails 3 onwards. You can add it to your Gemfile with:
10
9
 
11
- And then execute:
10
+ ```ruby
11
+ gem 'acts_as_user'
12
+ ```
12
13
 
13
- $ bundle
14
+ Then run the bundle command to install it.
14
15
 
15
- Or install it yourself as:
16
+ After you install ActsAsUser you need to run the generator:
16
17
 
17
- $ gem install acts_as_user
18
+ ```console
19
+ rails g acts_as_user:install
20
+ ```
18
21
 
19
- ## Usage
22
+ The generator will install in initializer which describes all the ActsAsUser configuration options, so we recommend you take a look at it. When you are done you are ready to start your user model:
20
23
 
21
- TODO: Write usage instructions here
24
+ ```console
25
+ rails g acts_as_user User <attributes>
26
+ ```
27
+
28
+ Next you'll probably want to run the migrations "rake db:migrate", as the generator will create a migration file (open it modify if you need to).
29
+
30
+ ##Configuration
31
+
32
+ For the models you want to inherit to you just have to add this line of code into them:
33
+
34
+ ```ruby
35
+ class Member
36
+ acts_as_user
37
+ end
38
+ ```
39
+
40
+ A little note on the User model...just in case!
41
+
42
+ ```ruby
43
+ class User
44
+ is_user
45
+ end
46
+ ```
47
+
48
+ ###Ignore attributes to delegate from the user
49
+
50
+ If you want to ignore some attributes from your user model to the childs, you can do it on the ```acts_as_user.rb``` initializer like so:
51
+
52
+ ```ruby
53
+ ActsAsUser.setup do |config|
54
+ config.ignored_attributes = ["name", "bio"]
55
+ end
56
+ ```
57
+
58
+ By default it ignores the following attributes:
59
+
60
+ ```ruby
61
+ ["created_at", "updated_at", "id", "userable_type", "userable_id"]
62
+ ```
63
+
64
+
65
+ ##Devise support
66
+
67
+ Yes we do!
68
+
69
+ Acts as a user plays well with Devise as it ignores and adds the corresponding attributes to delegate to.
70
+
71
+ When using devise, ActsAsUser will also ignore the ```encrypted_password``` attribute from the user. No further configuration needs to be done.
22
72
 
23
73
  ## Contributing
24
74
 
@@ -27,3 +77,33 @@ TODO: Write usage instructions here
27
77
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
78
  4. Push to the branch (`git push origin my-new-feature`)
29
79
  5. Create new Pull Request
80
+
81
+
82
+ ###Psst! Here is a live example in rails
83
+
84
+ [Rails acts as user example](https://github.com/IcaliaLabs)
85
+
86
+ ### Devs
87
+
88
+ * Abraham Kuri (https://github.com/kurenn)
89
+ * Patricio Beltrán (https://github.com/patobeltran)
90
+
91
+ ### Future
92
+
93
+ * Add tests
94
+ * Support for Mongoid
95
+ * Add wiki
96
+
97
+
98
+ ## Credits
99
+ Icalia Labs - weare@icalialabs.com
100
+
101
+ [Follow us](http://twitter.com/icalialabs "Follow us")
102
+
103
+
104
+ [Like us on Facebook](https://www.facebook.com/icalialab "Like us on Facebook")
105
+
106
+
107
+ ### License
108
+
109
+ MIT License. Copyright 2012-2013 IcaliaLabs. http://icalialabs.com
@@ -1,3 +1,3 @@
1
1
  module ActsAsUser
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,4 +1,4 @@
1
- class AddActsAsUser<%= table_name.camelize %> < ActiveRecord::Migration
1
+ class AddActsAsUserTo<%= table_name.camelize %> < ActiveRecord::Migration
2
2
  def self.up
3
3
  change_table(:<%= table_name %>) do |t|
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_user
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abraham Kuri