ajax_scaffold_generator 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,8 @@ class <%= controller_class_name %>Controller < ApplicationController
40
40
  def component
41
41
  update_params :default_scaffold_id => "<%= singular_name %>", :default_sort => nil, :default_sort_direction => "asc"
42
42
 
43
- @sort_by = current_sort(params).nil? ? "<%= plural_name %>.id asc" : <%= model_name %>.scaffold_columns_hash[current_sort(params)].sort_sql + " " + current_sort_direction(params)
43
+ @sort_sql = <%= model_name %>.scaffold_columns_hash[current_sort(params)].sort_sql rescue nil
44
+ @sort_by = @sort_sql.nil? ? "<%= plural_name %>.id asc" : @sort_sql + " " + current_sort_direction(params)
44
45
  @paginator, @<%= plural_name %> = paginate(:<%= plural_name %>, :order_by => @sort_by, :per_page => default_per_page)
45
46
 
46
47
  render :action => "component", :layout => false
@@ -8,10 +8,10 @@ module AjaxScaffold
8
8
  # based on the given class.
9
9
  def initialize(klass, options)
10
10
  @name = options[:name]
11
- @eval = options[:eval].nil? ? klass.to_s.downcase + "." + @name : options[:eval]
11
+ @eval = options[:eval].nil? ? Inflector.tableize(klass.to_s).singularize + "." + @name : options[:eval]
12
12
  @label = options[:label].nil? ? Inflector.titleize(@name) : options[:label]
13
13
  @sortable = options[:sortable].nil? ? true : options[:sortable]
14
- @sort_sql = options[:sort_sql].nil? ? Inflector.tableize(klass.to_s) + "." + @name : options[:sort_sql] unless !@sortable
14
+ @sort_sql = options[:sort_sql].nil? ? klass.table_name + "." + @name : options[:sort_sql] unless !@sortable
15
15
  end
16
16
 
17
17
  def sortable?
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: ajax_scaffold_generator
5
5
  version: !ruby/object:Gem::Version
6
- version: 3.1.0
7
- date: 2006-04-18 00:00:00 -04:00
6
+ version: 3.1.1
7
+ date: 2006-04-21 00:00:00 -04:00
8
8
  summary: Ajax scaffold generator is a rails generator for ajaxified scaffolds
9
9
  require_paths:
10
10
  - lib