inline_forms 0.9.16 → 0.9.17
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 +5 -10
- data/inline_forms.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.17
|
@@ -54,11 +54,9 @@ 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
|
-
if
|
58
|
-
|
59
|
-
|
60
|
-
@parent_class.nil? ? conditions = [] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
61
|
-
end
|
57
|
+
# if the parent_class is not nill, we are in associated list and we don't search there.
|
58
|
+
# also, make sure the Model that you want to do a search on has a :name attribute. TODO
|
59
|
+
@parent_class.nil? ? conditions = ["name like ?", "%#{params[:search]}%" ] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
62
60
|
if cancan_enabled?
|
63
61
|
@objects = @Klass.accessible_by(current_ability).order(@Klass.order_by_clause).paginate :page => params[:page], :conditions => conditions
|
64
62
|
else
|
@@ -120,11 +118,8 @@ class InlineFormsController < ApplicationController
|
|
120
118
|
end
|
121
119
|
@parent_class = params[:parent_class]
|
122
120
|
@parent_id = params[:parent_id]
|
123
|
-
|
124
|
-
|
125
|
-
else
|
126
|
-
@parent_class.nil? ? conditions = [] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
127
|
-
end
|
121
|
+
# for the logic behind the :conditions see the #index method.
|
122
|
+
@parent_class.nil? ? conditions = ["name like ?", "%#{params[:search]}%" ] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
128
123
|
object[@parent_class.foreign_key] = @parent_id unless @parent_class.nil?
|
129
124
|
if object.save
|
130
125
|
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: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 17
|
10
|
+
version: 0.9.17
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ace Suares
|