rails_extensions 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/init.rb +21 -0
- data/lib/m_active_record_base.rb +40 -0
- data/lib/m_form_tag_helper.rb +18 -0
- data/lib/rails_extensions.rb +21 -0
- data/lib/tasks/rubyforge_config.yml +5 -0
- metadata +58 -0
data/init.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# require 'find'
|
2
|
+
# path = File.join(RAILS_ROOT, "vendor", "plugins", "rails_extensions", "lib")
|
3
|
+
# Find.find(path) do |f|
|
4
|
+
# if FileTest.directory?(f) and f =~ /\.svn/
|
5
|
+
# Find.prune
|
6
|
+
# else
|
7
|
+
# if FileTest.file?(f)
|
8
|
+
# f.gsub!(path, "")
|
9
|
+
# m = f.match(/\/[a-zA\-Z-_]*.rb/)
|
10
|
+
# if m
|
11
|
+
# model = m.to_s
|
12
|
+
# x = model.gsub('/', '').gsub('.rb', '')
|
13
|
+
# begin
|
14
|
+
# require x
|
15
|
+
# rescue => ex
|
16
|
+
# puts ex
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
# end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class ActiveRecord::Base
|
2
|
+
|
3
|
+
def to_i
|
4
|
+
# return the id of the object when calling the to_i method.
|
5
|
+
self.id
|
6
|
+
end
|
7
|
+
|
8
|
+
def is_deleted?
|
9
|
+
if self.respond_to?(:deleted_at)
|
10
|
+
return !self.deleted_at.nil?
|
11
|
+
end
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
alias_method :old_update, :update
|
16
|
+
|
17
|
+
def update(check_validation = true)
|
18
|
+
if check_validation
|
19
|
+
return old_update if self.valid?
|
20
|
+
else
|
21
|
+
return old_update
|
22
|
+
end
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class << ActiveRecord::Base
|
29
|
+
|
30
|
+
alias_method :[], :find
|
31
|
+
|
32
|
+
def all(options = {})
|
33
|
+
self.find(:all, options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def first(options = {})
|
37
|
+
self.find(:first, options)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
module FormTagHelper
|
4
|
+
|
5
|
+
alias_method :old_submit_tag, :submit_tag
|
6
|
+
alias_method :old_image_submit_tag, :image_submit_tag
|
7
|
+
|
8
|
+
def submit_tag(value = "Save changes", options = {})
|
9
|
+
old_submit_tag(value, options.merge({:disable_with => value}))
|
10
|
+
end
|
11
|
+
|
12
|
+
def image_submit_tag(source, options = {})
|
13
|
+
old_image_submit_tag(source, options.merge({:onMouseDown => "javascript:disable_button(this)"}))
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'find'
|
2
|
+
path = File.join(RAILS_ROOT, "vendor", "plugins", "rails_extensions", "lib")
|
3
|
+
Find.find(path) do |f|
|
4
|
+
if FileTest.directory?(f) and f =~ /\.svn/
|
5
|
+
Find.prune
|
6
|
+
else
|
7
|
+
if FileTest.file?(f)
|
8
|
+
f.gsub!(path, "")
|
9
|
+
m = f.match(/\/[a-zA\-Z-_]*.rb/)
|
10
|
+
if m
|
11
|
+
model = m.to_s
|
12
|
+
x = model.gsub('/', '').gsub('.rb', '')
|
13
|
+
begin
|
14
|
+
require x unless x == "rails_extensions"
|
15
|
+
rescue => ex
|
16
|
+
puts ex
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
4
|
+
name: rails_extensions
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-09-13 00:00:00 -04:00
|
8
|
+
summary: rails_extensions
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
- lib
|
12
|
+
- lib
|
13
|
+
- lib/tasks
|
14
|
+
email:
|
15
|
+
homepage:
|
16
|
+
rubyforge_project: magrathea
|
17
|
+
description: "rails_extensions was developed by: markbates"
|
18
|
+
autorequire:
|
19
|
+
- rails_extensions
|
20
|
+
- m_form_tag_helper
|
21
|
+
- m_active_record_base
|
22
|
+
- m_form_tag_helper
|
23
|
+
- m_active_record_base
|
24
|
+
default_executable:
|
25
|
+
bindir: bin
|
26
|
+
has_rdoc: false
|
27
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">"
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.0.0
|
32
|
+
version:
|
33
|
+
platform: ruby
|
34
|
+
signing_key:
|
35
|
+
cert_chain:
|
36
|
+
post_install_message:
|
37
|
+
authors:
|
38
|
+
- markbates
|
39
|
+
files:
|
40
|
+
- init.rb
|
41
|
+
- lib/m_active_record_base.rb
|
42
|
+
- lib/m_form_tag_helper.rb
|
43
|
+
- lib/rails_extensions.rb
|
44
|
+
- lib/tasks/rubyforge_config.yml
|
45
|
+
test_files: []
|
46
|
+
|
47
|
+
rdoc_options: []
|
48
|
+
|
49
|
+
extra_rdoc_files: []
|
50
|
+
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
requirements: []
|
56
|
+
|
57
|
+
dependencies: []
|
58
|
+
|