access_loggable 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +32 -0
- data/Rakefile +2 -0
- data/access_loggable.gemspec +18 -0
- data/init.rb +5 -0
- data/lib/access_loggable.rb +17 -0
- metadata +70 -0
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Access Loggable
|
2
|
+
|
3
|
+
Rails gem that adds the method action!(title) for your ActiveRecord models.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
class User < ActiveRecord::Base
|
8
|
+
access_loggable
|
9
|
+
|
10
|
+
...
|
11
|
+
end
|
12
|
+
|
13
|
+
class EventsController < ApplicationController
|
14
|
+
|
15
|
+
def index
|
16
|
+
@events = current_user.events
|
17
|
+
respond_to do |format|
|
18
|
+
format.html { current_user.action!("events#index as HTML") }
|
19
|
+
format.js do
|
20
|
+
current_user.action!("events#index as JSON")
|
21
|
+
render :json => @events.map(&:to_calendar)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
...
|
27
|
+
end
|
28
|
+
|
29
|
+
## TODO
|
30
|
+
|
31
|
+
* support MongoDB
|
32
|
+
* tests
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "access_loggable"
|
3
|
+
s.version = "0.0.2"
|
4
|
+
s.date = "2011-02-06"
|
5
|
+
s.authors = ["Dimko"]
|
6
|
+
s.email = "deemox@gmail.com"
|
7
|
+
s.summary = "Provides easy way to register actions with your models"
|
8
|
+
s.homepage = "http://github.com/dimko/access_loggable"
|
9
|
+
s.rubyforge_project = s.name
|
10
|
+
s.has_rdoc = false
|
11
|
+
|
12
|
+
s.files = ["access_loggable.gemspec", "init.rb", "lib/access_loggable.rb", "Rakefile", "README.md"]
|
13
|
+
# s.require_path = "lib"
|
14
|
+
|
15
|
+
s.add_runtime_dependency 'rails', '>= 2.0.0'
|
16
|
+
|
17
|
+
s.required_rubygems_version = ">= 1.3.4"
|
18
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module AccessLoggable
|
2
|
+
def self.included(base)
|
3
|
+
base.extend(ClassMethods)
|
4
|
+
end
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
def access_loggable
|
8
|
+
class_eval do
|
9
|
+
has_many :access_logs, :as => :access_loggable
|
10
|
+
|
11
|
+
def action!(title)
|
12
|
+
access_logs.create(:action => title)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: access_loggable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.2
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dimko
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-06 00:00:00 +03:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rails
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.0.0
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
description:
|
28
|
+
email: deemox@gmail.com
|
29
|
+
executables: []
|
30
|
+
|
31
|
+
extensions: []
|
32
|
+
|
33
|
+
extra_rdoc_files: []
|
34
|
+
|
35
|
+
files:
|
36
|
+
- access_loggable.gemspec
|
37
|
+
- init.rb
|
38
|
+
- lib/access_loggable.rb
|
39
|
+
- Rakefile
|
40
|
+
- README.md
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: http://github.com/dimko/access_loggable
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.3.4
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project: access_loggable
|
65
|
+
rubygems_version: 1.6.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Provides easy way to register actions with your models
|
69
|
+
test_files: []
|
70
|
+
|