inline_forms 0.9.15 → 0.9.16
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/inline_forms_controller.rb +10 -3
- data/inline_forms.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.16
|
@@ -54,13 +54,16 @@ class InlineFormsController < ApplicationController
|
|
54
54
|
@parent_class = params[:parent_class]
|
55
55
|
@parent_id = params[:parent_id]
|
56
56
|
@ul_needed = params[:ul_needed]
|
57
|
-
@
|
57
|
+
if @Klass.new.respond_to? :name
|
58
|
+
@parent_class.nil? ? conditions = ["name like ?", "%#{params[:search]}%" ] : conditions = [ "name like ? AND #{@parent_class.foreign_key} = ?", "%#{params[:search]}%" , @parent_id ]
|
59
|
+
else
|
60
|
+
@parent_class.nil? ? conditions = [] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
61
|
+
end
|
58
62
|
if cancan_enabled?
|
59
63
|
@objects = @Klass.accessible_by(current_ability).order(@Klass.order_by_clause).paginate :page => params[:page], :conditions => conditions
|
60
64
|
else
|
61
65
|
@objects = @Klass.order(@Klass.order_by_clause).paginate :page => params[:page], :conditions => conditions
|
62
66
|
end
|
63
|
-
|
64
67
|
respond_to do |format|
|
65
68
|
# found this here: http://www.ruby-forum.com/topic/211467
|
66
69
|
format.html { render 'inline_forms/_list', :layout => 'inline_forms' } unless @Klass.not_accessible_through_html?
|
@@ -117,7 +120,11 @@ class InlineFormsController < ApplicationController
|
|
117
120
|
end
|
118
121
|
@parent_class = params[:parent_class]
|
119
122
|
@parent_id = params[:parent_id]
|
120
|
-
|
123
|
+
if object.respond_to? :name
|
124
|
+
@parent_class.nil? ? conditions = ["name like ?", "%#{params[:search]}%" ] : conditions = [ "name like ? AND #{@parent_class.foreign_key} = ?", "%#{params[:search]}%" , @parent_id ]
|
125
|
+
else
|
126
|
+
@parent_class.nil? ? conditions = [] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
127
|
+
end
|
121
128
|
object[@parent_class.foreign_key] = @parent_id unless @parent_class.nil?
|
122
129
|
if object.save
|
123
130
|
flash.now[:success] = "Successfully created #{object.class.to_s.underscore}."
|
data/inline_forms.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 16
|
10
|
+
version: 0.9.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ace Suares
|