inline_forms 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,19 +54,19 @@ class InlineFormsController < ApplicationController
54
54
  # if the parent_class is not nill, we are in associated list and we don't search there.
55
55
  # also, make sure the Model that you want to do a search on has a :name attribute. TODO
56
56
  if @parent_class.nil? || @Klass.reflect_on_association(@parent_class.underscore.to_sym).nil?
57
- conditions = [ @Klass.to_s.tableize + "." + @Klass.order_by_clause + " like ?", "%#{params[:search]}%" ]
57
+ conditions = [ @Klass.table_name + "." + @Klass.order_by_clause + " like ?", "%#{params[:search]}%" ]
58
58
  else
59
59
  foreign_key = @Klass.reflect_on_association(@parent_class.underscore.to_sym).options[:foreign_key] || @parent_class.foreign_key
60
60
  conditions = [ "#{foreign_key} = ?", @parent_id ]
61
61
  end
62
62
  # if we are using cancan, then make sure to select only accessible records
63
63
  if cancan_enabled?
64
- @objects = @Klass.accessible_by(current_ability).order(@Klass.to_s.tableize + "." + @Klass.order_by_clause).paginate(
64
+ @objects = @Klass.accessible_by(current_ability).order(@Klass.table_name + "." + @Klass.order_by_clause).paginate(
65
65
  :page => params[:page],
66
66
  :per_page => @PER_PAGE || 12,
67
67
  :conditions => conditions )
68
68
  else
69
- @objects = @Klass.order(@Klass.to_s.tableize + "." + @Klass.order_by_clause).paginate(
69
+ @objects = @Klass.order(@Klass.table_name + "." + @Klass.order_by_clause).paginate(
70
70
  :page => params[:page],
71
71
  :per_page => @PER_PAGE || 12,
72
72
  :conditions => conditions )
@@ -123,7 +123,7 @@ class InlineFormsController < ApplicationController
123
123
  @PER_PAGE = 5 unless @parent_class.nil?
124
124
  # for the logic behind the :conditions see the #index method.
125
125
  if @parent_class.nil? || @Klass.reflect_on_association(@parent_class.underscore.to_sym).nil?
126
- conditions = [ @Klass.to_s.tableize + "." + @Klass.order_by_clause + " like ?", "%#{params[:search]}%" ]
126
+ conditions = [ @Klass.table_name + "." + @Klass.order_by_clause + " like ?", "%#{params[:search]}%" ]
127
127
  else
128
128
  foreign_key = @Klass.reflect_on_association(@parent_class.underscore.to_sym).options[:foreign_key] || @parent_class.foreign_key
129
129
  conditions = [ "#{foreign_key} = ?", @parent_id ]
@@ -132,9 +132,9 @@ class InlineFormsController < ApplicationController
132
132
  if object.save
133
133
  flash.now[:success] = t('success', :message => object.class.model_name.human)
134
134
  if cancan_enabled?
135
- @objects = @Klass.accessible_by(current_ability).order(@Klass.to_s.tableize + "." + @Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
135
+ @objects = @Klass.accessible_by(current_ability).order(@Klass.table_name + "." + @Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
136
136
  else
137
- @objects = @Klass.order(@Klass.to_s.tableize + "." + @Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
137
+ @objects = @Klass.order(@Klass.table_name + "." + @Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
138
138
  end
139
139
  respond_to do |format|
140
140
  format.js { render :list}
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "1.5.1"
3
+ VERSION = "1.5.2"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-02 00:00:00.000000000 Z
12
+ date: 2012-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rvm