crud_for 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,22 +18,22 @@ module Methods
18
18
  expose(model.to_s.pluralize.to_sym) { search.paginate(:page => params[:page]) }
19
19
  else
20
20
  if _options[:paginate]
21
- expose(model.to_s.pluralize.to_sym) { model.to_s.capitalize.constantize.paginate(:page => params[:page]) }
21
+ expose(model.to_s.pluralize.to_sym) { model.to_s.camelize.constantize.paginate(:page => params[:page]) }
22
22
  else
23
23
  if _options[:search]
24
24
  expose(model.to_s.pluralize.to_sym) { search.all }
25
25
  else
26
- expose(model.to_s.pluralize.to_sym) { model.to_s.capitalize.constantize.all }
26
+ expose(model.to_s.pluralize.to_sym) { model.to_s.camelize.constantize.all }
27
27
  end
28
28
  end
29
29
  end
30
30
 
31
- expose(:search) { model.to_s.capitalize.constantize.search(params[:search]) } if _options[:search]
31
+ expose(:search) { model.to_s.camelize.constantize.search(params[:search]) } if _options[:search]
32
32
 
33
33
  self.class_eval %"
34
34
  def create
35
35
  if #{model}.save
36
- redirect_to #{model.to_s.pluralize}_url, I18n.t(:create_success, :model => #{model.to_s.capitalize.constantize}.human_name)
36
+ redirect_to #{model.to_s.pluralize}_url, :notice => I18n.t(:create_success, :model => #{model.to_s.camelize.constantize}.human_name)
37
37
  else
38
38
  render 'new'
39
39
  end
@@ -43,9 +43,9 @@ module Methods
43
43
  self.class_eval %"
44
44
  def update
45
45
  if #{model}.update_attributes(params['#{model.to_sym}'])
46
- redirect_to #{model.to_s.pluralize}_url, I18n.t(:update_success, :model => #{model.to_s.capitalize.constantize}.human_name)
46
+ redirect_to #{model.to_s.pluralize}_url, :notice => I18n.t(:update_success, :model => #{model.to_s.camelize.constantize}.human_name)
47
47
  else
48
-
48
+ render 'edit'
49
49
  end
50
50
  end
51
51
  " if _options[:update]
@@ -53,7 +53,7 @@ module Methods
53
53
  self.class_eval %"
54
54
  def destroy
55
55
  #{model}.destroy
56
- redirect_to #{model.to_s.pluralize}_url, I18n.t(:destroy_success, :model => #{model.to_s.capitalize.constantize}.human_name)
56
+ redirect_to #{model.to_s.pluralize}_url, :notice => I18n.t(:destroy_success, :model => #{model.to_s.camelize.constantize}.human_name)
57
57
  end
58
58
  " if _options[:destroy]
59
59
 
@@ -1,3 +1,3 @@
1
1
  module CrudFor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crud_for
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcello Milhomem Albuquerque
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-11 00:00:00 -03:00
18
+ date: 2011-06-15 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency