active_scaffold-sequel 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  sorting = active_scaffold_config.list.user.sorting
3
- sorting_stages = ['reset', 'ASC', 'DESC']
3
+ sorting_stages = ActiveScaffold::Ring.new(['reset', 'ASC', 'DESC'])
4
4
  default_sorting = active_scaffold_config.list.user.default_sorting
5
- default_sorting_stages = ['ASC', 'DESC']
5
+ default_sorting_stages = ActiveScaffold::Ring.new(['ASC', 'DESC'])
6
6
  -%>
7
7
  <% columns.each do |column| -%>
8
8
  <% stages = default_sorting.sorts_on?(column) ? default_sorting_stages : sorting_stages -%>
@@ -10,5 +10,4 @@ action_links ||= active_scaffold_config.action_links.member
10
10
  <tr class="record <%= tr_class %>" id="<%= element_row_id(:action => :list, :id => record.id) %>" data-refresh="<%= url_for(params_for(:action => :row, :id => record.id, :_method => :get)).html_safe %>">
11
11
  <%= render :partial => 'list_record_columns', :locals => {:record => record, :columns => columns} %>
12
12
  <%= render :partial => 'list_actions', :locals => {:record => record, :url_options => url_options, :action_links => action_links} unless action_links.empty? %>
13
- <%= render_nested_view(action_links, url_options, record) unless @nested_auto_open.nil? %>
14
13
  </tr>
@@ -1,16 +1,6 @@
1
1
  <%messages_id = active_scaffold_messages_id%>
2
2
  <%if controller.send(:successful?)%>
3
- <%if render_parent? && controller.respond_to?(:render_component_into_view)%>
4
- <%render_parent_options%>
5
- <%if render_parent_action == :row%>
6
- <%# TODO: That s not working with delete....%>
7
- ActiveScaffold.delete_record_row('<%=element_row_id(:controller_id => "as_#{id_from_controller(params[:eid] || params[:parent_sti])}", :action => 'list', :id => params[:id])%>', '<%=url_for(params_for(:action => :index, :id => nil, :page => [active_scaffold_config.list.user.page.to_i - 1, 1].max))%>');
8
- <%messages_id = active_scaffold_messages_id(:controller_id => "as_#{id_from_controller(params[:eid] || params[:parent_sti])}")%>
9
- <%elsif render_parent_action == :index%>
10
- <%= escape_javascript(controller.send(:render_component_into_view, render_parent_options))%>
11
- <%end%>
12
- <%#page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
13
- <%elsif (active_scaffold_config.delete.refresh_list)%>
3
+ <% if (active_scaffold_config.delete.refresh_list)%>
14
4
  ActiveScaffold.replace('<%=active_scaffold_content_id%>', '<%=escape_javascript(render(:partial => 'list', :layout => false))%>');
15
5
  <%else%>
16
6
  ActiveScaffold.delete_record_row('<%=element_row_id(:action => 'list', :id => params[:id])%>', '<%=url_for(params_for(:action => :index, :id => nil, :page => [active_scaffold_config.list.user.page.to_i - 1, 1].max))%>');
@@ -4,22 +4,7 @@ insert_at ||= :top %>
4
4
  var action_link = ActiveScaffold.find_action_link('<%= form_selector%>');
5
5
  action_link.update_flash_messages('<%=escape_javascript(render(:partial => 'messages'))%>');
6
6
  <% if controller.send :successful? %>
7
- <% if render_parent? && controller.respond_to?(:render_component_into_view) %>
8
- <% parent_rendered = controller.send(:render_component_into_view, render_parent_options) %>
9
- <% if nested_singular_association? %>
10
- action_link.close('<%= escape_javascript(parent_rendered)%>');
11
- <% else %>
12
- <% if render_parent_action == :row %>
13
- ActiveScaffold.create_record_row(action_link.scaffold(),'<%= escape_javascript(parent_rendered)%>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
14
- <% elsif render_parent_action == :index %>
15
- <%= escape_javascript(parent_rendered) %>
16
- <% end %>
17
- action_link.close();
18
- <% end %>
19
- <% if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
20
- ActiveScaffold.replace('<%=active_scaffold_calculations_id%>', '<%=escape_javascript(render(:partial => 'list_calculations'))%>');
21
- <% end %>
22
- <% elsif (active_scaffold_config.create.refresh_list) %>
7
+ <% if (active_scaffold_config.create.refresh_list) %>
23
8
  ActiveScaffold.replace_html('<%= active_scaffold_content_id%>', '<%= escape_javascript(render(:partial => 'list', :layout => false)) %>');
24
9
  <% elsif params[:parent_controller].nil? %>
25
10
  <% new_row = render :partial => 'list_record', :locals => {:record => @record} %>
@@ -3,19 +3,7 @@ try {
3
3
  var action_link = ActiveScaffold.find_action_link('<%= form_selector%>');
4
4
  action_link.update_flash_messages('<%=escape_javascript(render(:partial => 'messages'))%>');
5
5
  <% if controller.send :successful? %>
6
- <% if render_parent? && controller.respond_to?(:render_component_into_view) %>
7
- <% parent_rendered = controller.send(:render_component_into_view, render_parent_options) %>
8
- <% if nested_singular_association? %>
9
- action_link.close('<%= escape_javascript(parent_rendered)%>');
10
- <% else %>
11
- <% if render_parent_action == :row %>
12
- action_link.close('<%= escape_javascript(parent_rendered)%>');
13
- <% elsif render_parent_action == :index %>
14
- <%= escape_javascript(parent_rendered) %>
15
- <% end %>
16
- <% end %>
17
- <%#page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
18
- <% elsif update_refresh_list? %>
6
+ <% if update_refresh_list? %>
19
7
  ActiveScaffold.replace_html('<%= active_scaffold_content_id%>', '<%= escape_javascript(render(:partial => 'list', :layout => false))%>');
20
8
  <% else %>
21
9
  <% updated_row = render :partial => 'list_record', :locals => {:record => @record}%>
@@ -2,12 +2,6 @@ unless Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1
2
2
  raise "This version of ActiveScaffold requires Rails 3.1 or higher. Please use an earlier version."
3
3
  end
4
4
 
5
- begin
6
- require 'render_component'
7
- rescue LoadError
8
- end
9
-
10
-
11
5
  require 'active_scaffold/version'
12
6
  require 'active_scaffold/engine' unless defined? ACTIVE_SCAFFOLD_PLUGIN
13
7
  require 'json' # for js_config
@@ -15,7 +9,9 @@ require 'json' # for js_config
15
9
  module ActiveScaffold
16
10
  require 'active_scaffold/paginator'
17
11
  require 'active_scaffold/responds_to_parent'
18
- require 'active_scaffold/active_record_permissions'
12
+ require 'active_scaffold/model_permissions'
13
+ require 'active_scaffold/render'
14
+ require 'active_scaffold/ring'
19
15
 
20
16
  autoload :AttributeParams, 'active_scaffold/attribute_params'
21
17
  autoload :Configurable, 'active_scaffold/configurable'
@@ -171,6 +167,9 @@ module ActiveScaffold
171
167
  # run the configuration
172
168
  @active_scaffold_config = ActiveScaffold::Config::Core.new(model_id)
173
169
  @active_scaffold_config_block = block
170
+
171
+ @active_scaffold_config.model.class_eval {include ActiveScaffold::ModelPermissions::Permissions}
172
+
174
173
  self.links_for_associations
175
174
 
176
175
  @active_scaffold_frontends = []
@@ -190,6 +189,7 @@ module ActiveScaffold
190
189
 
191
190
  # include the rest of the code into the controller: the action core and the included actions
192
191
  module_eval do
192
+ include ActiveScaffold::Render
193
193
  include ActiveScaffold::Finder
194
194
  include ActiveScaffold::Constraints
195
195
  include ActiveScaffold::AttributeParams
@@ -142,7 +142,7 @@ module ActiveScaffold::Actions
142
142
  # Overide this method on your controller to provide model with named scopes
143
143
  # This method returns a model class or a dataset.
144
144
  def beginning_of_chain
145
- active_scaffold_config.model
145
+ active_scaffold_config.model.qualify
146
146
  end
147
147
 
148
148
  # This method returns a model class.
@@ -158,7 +158,7 @@ module ActiveScaffold::Actions
158
158
  def conditions_from_params
159
159
  conditions = nil
160
160
  params.reject {|key, value| [:controller, :action, :id, :page, :sort, :sort_direction].include?(key.to_sym)}.each do |key, value|
161
- next unless active_scaffold_config.model.columns.include?(key)
161
+ next unless active_scaffold_config.model.columns.include?(key.to_sym)
162
162
  conditions = merge_conditions(conditions, {"#{active_scaffold_config.model.table_name}__#{key}".to_sym => value})
163
163
  end
164
164
  conditions
@@ -17,7 +17,6 @@ module ActiveScaffold::Actions
17
17
 
18
18
  def list
19
19
  do_list
20
- @nested_auto_open = active_scaffold_config.list.nested_auto_open
21
20
  respond_to_action(:list)
22
21
  end
23
22
 
@@ -80,10 +80,11 @@ module ActiveScaffold::Actions
80
80
  if nested.association.returns_array?
81
81
  nested.parent_scope.send("#{nested.association[:name]}_dataset")
82
82
  elsif nested.child_association[:type] == :many_to_one
83
- active_scaffold_config.model.where((nested.child_association[:key] || nested.child_association[:left_key]) => nested.parent_id)
83
+ active_scaffold_config.model.qualify.where((nested.child_association[:key] || nested.child_association[:left_key]) => nested.parent_id)
84
84
  end
85
85
  else
86
- active_scaffold_config.model
86
+ # specified in actions/core.rb
87
+ super
87
88
  end
88
89
  end
89
90
 
@@ -40,7 +40,6 @@ module ActiveScaffold::Config
40
40
 
41
41
  # access to the permissions configuration.
42
42
  # configuration options include:
43
- # * current_user_method - what method on the controller returns the current user. default: :current_user
44
43
  # * default_permission - what the default permission is. default: true
45
44
  def self.security
46
45
  ModelPermissions
@@ -132,13 +132,7 @@ module ActiveScaffold::Config
132
132
  def hide_nested_column
133
133
  @hide_nested_column.nil? ? true : @hide_nested_column
134
134
  end
135
-
136
- # might be set to open nested_link automatically in view
137
- # conf.nested.add_link(:players)
138
- # conf.list.nested_auto_open = {:players => 2}
139
- # will open nested players view if there are 2 or less records in parent
140
- attr_accessor :nested_auto_open
141
-
135
+
142
136
  class UserSettings < UserSettings
143
137
  # This label has alread been localized.
144
138
  def label
@@ -73,25 +73,20 @@ module ActionView::Helpers #:nodoc:
73
73
  id = "as_#{eid}-embedded"
74
74
  url_options = {:controller => remote_controller.to_s, :action => 'index'}.merge(options[:params])
75
75
 
76
- if controller.respond_to?(:render_component_into_view)
77
- controller.send(:render_component_into_view, url_options)
78
- else
79
- content_tag(:div, :id => id, :class => 'active-scaffold-component') do
80
- url = url_for(url_options)
81
- # parse the ActiveRecord model name from the controller path, which
82
- # might be a namespaced controller (e.g., 'admin/admins')
83
- model = remote_controller.to_s.sub(/.*\//, '').singularize
84
- content_tag(:div, :class => 'active-scaffold-header') do
85
- content_tag :h2, link_to(args.first[:label] || active_scaffold_config_for(model).list.label, url, :remote => true)
86
- end <<
87
- if ActiveScaffold.js_framework == :prototype
88
- javascript_tag("new Ajax.Updater('#{id}', '#{url}', {method: 'get', evalScripts: true});")
89
- elsif ActiveScaffold.js_framework == :jquery
90
- javascript_tag("jQuery('##{id}').load('#{url}');")
91
- end
76
+ content_tag(:div, :id => id, :class => 'active-scaffold-component') do
77
+ url = url_for(url_options)
78
+ # parse the ActiveRecord model name from the controller path, which
79
+ # might be a namespaced controller (e.g., 'admin/admins')
80
+ model = remote_controller.to_s.sub(/.*\//, '').singularize
81
+ content_tag(:div, :class => 'active-scaffold-header') do
82
+ content_tag :h2, link_to(args.first[:label] || active_scaffold_config_for(model).list.label, url, :remote => true)
83
+ end <<
84
+ if ActiveScaffold.js_framework == :prototype
85
+ javascript_tag("new Ajax.Updater('#{id}', '#{url}', {method: 'get', evalScripts: true});")
86
+ elsif ActiveScaffold.js_framework == :jquery
87
+ javascript_tag("jQuery('##{id}').load('#{url}');")
92
88
  end
93
89
  end
94
-
95
90
  else
96
91
  options = args.first
97
92
  if options.is_a?(Hash)
@@ -365,7 +365,7 @@ module ActiveScaffold
365
365
  value = '' if value.nil?
366
366
  value
367
367
  }
368
- collection.reverse! if order.downcase == 'desc'
368
+ collection.reverse! if order[:descending]
369
369
  collection
370
370
  end
371
371
  end
@@ -305,7 +305,6 @@ module ActiveScaffold
305
305
  content_tag(:th, column_heading_value(column, sorting, sort_direction) + inplace_edit_control(column), tag_options)
306
306
  end
307
307
 
308
-
309
308
  def column_heading_value(column, sorting, sort_direction)
310
309
  if column.sortable?
311
310
  options = {:id => nil, :class => "as_sort",
@@ -322,19 +321,6 @@ module ActiveScaffold
322
321
  end
323
322
  end
324
323
  end
325
-
326
- def render_nested_view(action_links, url_options, record)
327
- rendered = []
328
- action_links.member.each do |link|
329
- if link.column && @nested_auto_open[link.column.name] && @records.length <= @nested_auto_open[link.column.name] && controller.respond_to?(:render_component_into_view)
330
- link_url_options = {:adapter => '_list_inline_adapter', :format => :js}.merge(action_link_url_options(link, url_options, record, options = {:reuse_eid => true}))
331
- link_id = get_action_link_id(link_url_options, record, link.column)
332
- rendered << (controller.send(:render_component_into_view, link_url_options) + javascript_tag("ActiveScaffold.ActionLink.get('#{link_id}').set_opened();"))
333
- end
334
- end
335
- rendered.join(' ').html_safe
336
- end
337
-
338
324
  end
339
325
  end
340
326
  end
@@ -79,7 +79,7 @@ module ActiveScaffold
79
79
 
80
80
  # a general-use loading indicator (the "stuff is happening, please wait" feedback)
81
81
  def loading_indicator_tag(options)
82
- image_tag(active_scaffold_config.class.asset_path('indicator.gif'), :style => "visibility:hidden;", :id => loading_indicator_id(options), :alt => "loading indicator", :class => "loading-indicator")
82
+ image_tag "active_scaffold/indicator.gif", :style => "visibility:hidden;", :id => loading_indicator_id(options), :alt => "loading indicator", :class => "loading-indicator"
83
83
  end
84
84
 
85
85
  # Creates a javascript-based link that toggles the visibility of some element on the page.
@@ -1,79 +1,25 @@
1
- # This module attempts to create permissions conventions for your ActiveRecord models. It supports english-based
1
+ # This module attempts to create permissions conventions for your models. It supports english-based
2
2
  # methods that let you restrict access per-model, per-record, per-column, per-action, and per-user. All at once.
3
3
  #
4
4
  # You may define instance methods in the following formats:
5
5
  # def #{column}_authorized_for_#{action}?
6
6
  # def #{column}_authorized?
7
7
  # def authorized_for_#{action}?
8
- #
9
- # Your methods should allow for the following special cases:
10
- # * cron scripts
11
- # * guest users (or nil current_user objects)
8
+
12
9
  module ActiveScaffold
13
10
  module ModelPermissions
14
- # ModelPermissions needs to know what method on your ApplicationController will return the current user,
15
- # if available. This defaults to the :current_user method. You may configure this in your environment.rb if you
16
- # have a different setup.
17
- def self.current_user_method=(v); @@current_user_method = v; end
18
- def self.current_user_method; @@current_user_method; end
19
- @@current_user_method = :current_user
20
-
21
11
  # Whether the default permission is permissive or not
22
12
  # If set to true, then everything's allowed until configured otherwise
23
13
  def self.default_permission=(v); @@default_permission = v; end
24
14
  def self.default_permission; @@default_permission; end
25
15
  @@default_permission = true
26
16
 
27
- # This is a module aimed at making the current_user available to ActiveRecord models for permissions.
28
- module ModelUserAccess
29
- module Controller
30
- def self.included(base)
31
- base.prepend_before_filter :assign_current_user_to_models
32
- end
33
-
34
- # We need to give the ActiveRecord classes a handle to the current user. We don't want to just pass the object,
35
- # because the object may change (someone may log in or out). So we give ActiveRecord a proc that ties to the
36
- # current_user_method on this ApplicationController.
37
- def assign_current_user_to_models
38
- Sequel::Model.current_user_proc = proc {send(ModelPermissions.current_user_method)}
39
- end
40
- end
41
-
42
- module Model
43
- def self.included(base)
44
- base.extend ClassMethods
45
- end
46
-
47
- module ClassMethods
48
- # The proc to call that retrieves the current_user from the ApplicationController.
49
- attr_accessor :current_user_proc
50
-
51
- # Class-level access to the current user
52
- def current_user
53
- Sequel::Model.current_user_proc.call if Sequel::Model.current_user_proc
54
- end
55
- end
56
-
57
- # Instance-level access to the current user
58
- def current_user
59
- self.class.current_user
60
- end
61
- end
62
- end
63
-
64
17
  module Permissions
65
18
  def self.included(base)
66
19
  base.extend SecurityMethods
67
20
  base.send :include, SecurityMethods
68
21
  end
69
22
 
70
- # Because any class-level queries get delegated to the instance level via a new record,
71
- # it's useful to know when the authorization query is meant for a specific record or not.
72
- # But using new? is confusing, even though accurate. So this is basically just a wrapper.
73
- def existing_record_check?
74
- !new?
75
- end
76
-
77
23
  module SecurityMethods
78
24
  # A generic authorization query. This is what will be called programatically, since
79
25
  # the actual permission methods can't be guaranteed to exist. And because we want to
@@ -1,22 +1,18 @@
1
- # wrap the action rendering for ActiveScaffold controllers
2
- module ActionController #:nodoc:
3
- class Base
4
- def render_with_active_scaffold(*args, &block)
5
- if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil?
1
+ module ActiveScaffold
2
+ # wrap the action rendering for ActiveScaffold controllers
3
+ module Render
4
+ def render(*args, &block)
5
+ if params[:adapter] and @rendering_adapter.nil?
6
6
  @rendering_adapter = true # recursion control
7
7
  # if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
8
8
  opts = args.blank? ? Hash.new : args.first
9
- render :partial => params[:adapter][1..-1],
9
+ super :partial => params[:adapter][1..-1],
10
10
  :locals => {:payload => render_to_string(opts.merge(:layout => false), &block).html_safe},
11
11
  :use_full_path => true, :layout => false, :content_type => :html
12
12
  @rendering_adapter = nil # recursion control
13
13
  else
14
- render_without_active_scaffold(*args, &block)
14
+ super
15
15
  end
16
16
  end
17
- alias_method_chain :render, :active_scaffold
18
-
19
- # Rails 2.x implementation is post-initialization on :active_scaffold method
20
17
  end
21
18
  end
22
-
@@ -0,0 +1,6 @@
1
+ class ActiveScaffold::Ring < ::Array
2
+ # Returns the value after the given value. Wraps around.
3
+ def after(value)
4
+ include?(value) ? self[(index(value).to_i + 1) % length] : nil
5
+ end
6
+ end
@@ -1,7 +1,7 @@
1
1
  module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 4
4
+ MINOR = 5
5
5
  PATCH = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
@@ -5,7 +5,3 @@ ActionController::Base.send(:include, ActiveScaffold)
5
5
  ActionController::Base.send(:include, ActiveScaffold::RespondsToParent)
6
6
  ActionController::Base.send(:include, ActiveScaffold::Helpers::ControllerHelpers)
7
7
  ActionView::Base.send(:include, ActiveScaffold::Helpers::ViewHelpers)
8
-
9
- ActionController::Base.class_eval {include ActiveScaffold::ModelPermissions::ModelUserAccess::Controller}
10
- Sequel::Model.class_eval {include ActiveScaffold::ModelPermissions::ModelUserAccess::Model}
11
- Sequel::Model.class_eval {include ActiveScaffold::ModelPermissions::Permissions}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: active_scaffold-sequel
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.0
5
+ version: 0.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Many, see README
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-02 00:00:00 Z
13
+ date: 2012-03-20 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: shoulda
@@ -186,7 +186,8 @@ files:
186
186
  - lib/active_scaffold/actions/show.rb
187
187
  - lib/active_scaffold/actions/subform.rb
188
188
  - lib/active_scaffold/actions/update.rb
189
- - lib/active_scaffold/active_record_permissions.rb
189
+ - lib/active_scaffold/render.rb
190
+ - lib/active_scaffold/ring.rb
190
191
  - lib/active_scaffold/attribute_params.rb
191
192
  - lib/active_scaffold/bridges.rb
192
193
  - lib/active_scaffold/bridges/calendar_date_select.rb
@@ -238,17 +239,13 @@ files:
238
239
  - lib/active_scaffold/data_structures/set.rb
239
240
  - lib/active_scaffold/data_structures/sorting.rb
240
241
  - lib/active_scaffold/engine.rb
241
- - lib/active_scaffold/extensions/action_controller_rendering.rb
242
- - lib/active_scaffold/extensions/action_view_rendering.rb
243
- - lib/active_scaffold/extensions/active_record_offset.rb
244
242
  - lib/active_scaffold/extensions/to_label.rb
245
- - lib/active_scaffold/extensions/array.rb
243
+ - lib/active_scaffold/extensions/action_view_rendering.rb
244
+ - lib/active_scaffold/extensions/unsaved_associated.rb
245
+ - lib/active_scaffold/extensions/unsaved_record.rb
246
246
  - lib/active_scaffold/extensions/paginator_extensions.rb
247
247
  - lib/active_scaffold/extensions/localize.rb
248
248
  - lib/active_scaffold/extensions/name_option_for_datetime.rb
249
- - lib/active_scaffold/extensions/nil_id_in_url_params.rb
250
- - lib/active_scaffold/extensions/unsaved_associated.rb
251
- - lib/active_scaffold/extensions/unsaved_record.rb
252
249
  - lib/active_scaffold/extensions/routing_mapper.rb
253
250
  - lib/active_scaffold/extensions/usa_state.rb
254
251
  - lib/active_scaffold/finder.rb
@@ -266,6 +263,7 @@ files:
266
263
  - lib/active_scaffold/paginator.rb
267
264
  - lib/active_scaffold/responds_to_parent.rb
268
265
  - lib/active_scaffold/version.rb
266
+ - lib/active_scaffold/model_permissions.rb
269
267
  - lib/active_scaffold_env.rb
270
268
  - lib/generators/active_scaffold/USAGE
271
269
  - lib/generators/active_scaffold/active_scaffold_generator.rb
@@ -1,12 +0,0 @@
1
- # Bugfix: Team.offset(1).limit(1) throws an error
2
- Sequel::Model.instance_eval do
3
- def offset(*args, &block)
4
- scoped.__send__(:offset, *args, &block)
5
- rescue NoMethodError
6
- if scoped.nil?
7
- 'depends on :allow_nil'
8
- else
9
- raise
10
- end
11
- end
12
- end
@@ -1,7 +0,0 @@
1
- class Array
2
- # returns the value after the given value. wraps around. defaults to first element in array.
3
- def after(value)
4
- return nil unless include? value
5
- self[(index(value).to_i + 1) % length]
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- class ActionController::Routing::RouteSet
2
- def generate_with_nil_id_awareness(*args)
3
- args[0].delete(:id) if args[0][:id].nil?
4
- generate_without_nil_id_awareness(*args)
5
- end
6
- alias_method_chain :generate, :nil_id_awareness
7
- end