giraffesoft-resource_controller 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.rdoc +10 -0
- data/VERSION.yml +2 -2
- data/lib/resource_controller/controller.rb +1 -1
- data/test/config/boot.rb +6 -5
- data/test/config/environment.rb +2 -2
- data/test/test/test_helper.rb +3 -2
- metadata +10 -7
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2008 James Golick
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -72,6 +72,16 @@ Or you can create a whole new block. This syntax destroys everything that's the
|
|
72
72
|
wants.js { render :template => "show.rjs" }
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
If you have a nested resource and want to redirect to the parent after create/update and destroy you can do this in the object controller
|
77
|
+
|
78
|
+
class CommentsController < ResourceController::Base
|
79
|
+
belongs_to :post
|
80
|
+
|
81
|
+
create.wants.html { redirect_to smart_url(parent_url_options) }
|
82
|
+
update.wants.html { redirect_to smart_url(parent_url_options) }
|
83
|
+
destroy.wants.html { redirect_to smart_url(parent_url_options) }
|
84
|
+
end
|
75
85
|
|
76
86
|
=== Scoping
|
77
87
|
|
data/VERSION.yml
CHANGED
@@ -11,7 +11,7 @@ module ResourceController
|
|
11
11
|
NAME_ACCESSORS.each { |accessor| send(accessor, controller_name.singularize.underscore) }
|
12
12
|
|
13
13
|
ACTIONS.each do |action|
|
14
|
-
class_scoping_reader action, FAILABLE_ACTIONS.include?(action) ? FailableActionOptions.new : ActionOptions.new
|
14
|
+
class_scoping_reader action, FAILABLE_ACTIONS.include?(action) ? ResourceController::FailableActionOptions.new : ResourceController::ActionOptions.new
|
15
15
|
end
|
16
16
|
|
17
17
|
self.helper_method :object_url, :edit_object_url, :new_object_url, :collection_url, :object, :collection,
|
data/test/config/boot.rb
CHANGED
@@ -44,6 +44,7 @@ module Rails
|
|
44
44
|
def load_initializer
|
45
45
|
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
46
|
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
@@ -67,7 +68,7 @@ module Rails
|
|
67
68
|
|
68
69
|
class << self
|
69
70
|
def rubygems_version
|
70
|
-
Gem::RubyGemsVersion
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
71
72
|
end
|
72
73
|
|
73
74
|
def gem_version
|
@@ -82,14 +83,14 @@ module Rails
|
|
82
83
|
|
83
84
|
def load_rubygems
|
84
85
|
require 'rubygems'
|
85
|
-
|
86
|
-
unless rubygems_version >=
|
87
|
-
$stderr.puts %(Rails requires RubyGems >=
|
86
|
+
min_version = '1.3.1'
|
87
|
+
unless rubygems_version >= min_version
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
89
|
exit 1
|
89
90
|
end
|
90
91
|
|
91
92
|
rescue LoadError
|
92
|
-
$stderr.puts %(Rails requires RubyGems >=
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
93
94
|
exit 1
|
94
95
|
end
|
95
96
|
|
data/test/config/environment.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# ENV['RAILS_ENV'] ||= 'production'
|
6
6
|
|
7
7
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
RAILS_GEM_VERSION = '2.3.
|
8
|
+
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
|
9
9
|
|
10
10
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
11
|
require File.join(File.dirname(__FILE__), 'boot')
|
@@ -30,7 +30,7 @@ Rails::Initializer.run do |config|
|
|
30
30
|
# (create the session table with 'rake db:sessions:create')
|
31
31
|
# config.action_controller.session_store = :active_record_store
|
32
32
|
config.gem "resource_controller", :version => "10.0.0"
|
33
|
-
config.gem "thoughtbot-shoulda", :lib => "shoulda/rails"
|
33
|
+
config.gem "thoughtbot-shoulda", :lib => "shoulda/rails", :version => "2.9.0"
|
34
34
|
|
35
35
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
36
36
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
data/test/test/test_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
$:.reject! { |path| path.include? 'TextMate' }
|
2
|
+
require 'test/unit'
|
2
3
|
ENV["RAILS_ENV"] = "test"
|
3
4
|
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
4
5
|
require 'test_help'
|
@@ -7,6 +8,6 @@ require 'mocha'
|
|
7
8
|
class ActiveSupport::TestCase
|
8
9
|
self.use_transactional_fixtures = true
|
9
10
|
self.use_instantiated_fixtures = false
|
10
|
-
|
11
|
-
|
11
|
+
|
12
|
+
fixtures :all
|
12
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giraffesoft-resource_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Golick
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -19,8 +19,9 @@ executables: []
|
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
- LICENSE
|
24
25
|
files:
|
25
26
|
- README.rdoc
|
26
27
|
- VERSION.yml
|
@@ -302,11 +303,13 @@ files:
|
|
302
303
|
- test/vendor/gems
|
303
304
|
- test/vendor/gems/resource_controller-10.0.0
|
304
305
|
- rails/init.rb
|
305
|
-
|
306
|
+
- LICENSE
|
307
|
+
has_rdoc: true
|
306
308
|
homepage: http://jamesgolick.com/resource_controller
|
307
309
|
post_install_message:
|
308
|
-
rdoc_options:
|
309
|
-
|
310
|
+
rdoc_options:
|
311
|
+
- --inline-source
|
312
|
+
- --charset=UTF-8
|
310
313
|
require_paths:
|
311
314
|
- lib
|
312
315
|
required_ruby_version: !ruby/object:Gem::Requirement
|