merb_datamapper 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ GEM_EMAIL = "jtoy@rubynow.com"
20
20
 
21
21
  GEM_NAME = "merb_datamapper"
22
22
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
23
- GEM_VERSION = (Merb::VERSION rescue "0.9.9") + PKG_BUILD
23
+ GEM_VERSION = Merb::VERSION + PKG_BUILD
24
24
 
25
25
  RELEASE_NAME = "REL #{GEM_VERSION}"
26
26
 
@@ -14,6 +14,8 @@ end
14
14
  Merb::Generators::ResourceControllerGenerator.template :controller_datamapper, :orm => :datamapper do |t|
15
15
  t.source = File.join(File.dirname(__FILE__), "templates/resource_controller.rb")
16
16
  t.destination = File.join("app/controllers", base_path, "#{file_name}.rb")
17
+
18
+ self.add_resource_route(self.plural_model)
17
19
  end
18
20
 
19
21
  [:index, :show, :edit, :new].each do |view|
@@ -3,7 +3,7 @@ class <%= class_name %>
3
3
  include DataMapper::Resource
4
4
 
5
5
  property :id, Serial
6
- <% attributes.each do |name, type| -%>
6
+ <% attributes.each do |name, type| %>
7
7
  property :<%= name -%>, <%= datamapper_type(type) -%>
8
8
  <% end %>
9
9
 
@@ -16,7 +16,7 @@ class <%= class_name %> < Application
16
16
  def new
17
17
  only_provides :html
18
18
  @<%= singular_model %> = <%= model_class_name %>.new
19
- display <%= model_class_name %>
19
+ display @<%= singular_model %>
20
20
  end
21
21
 
22
22
  def edit(id)
@@ -27,16 +27,17 @@ class <%= class_name %> < Application
27
27
  end
28
28
 
29
29
  def create(<%= singular_model %>)
30
- @<%= singular_model %> = <%= model_class_name %>.new(params[:<%= singular_model %>])
30
+ @<%= singular_model %> = <%= model_class_name %>.new(<%= singular_model %>)
31
31
  if @<%= singular_model %>.save
32
32
  redirect resource(@<%= singular_model %>), :message => {:notice => "<%= model_class_name %> was successfully created"}
33
33
  else
34
+ message[:error] = "<%= model_class_name %> failed to be created"
34
35
  render :new
35
36
  end
36
37
  end
37
38
 
38
- def update(<%= singular_model %>)
39
- @<%= singular_model %> = <%= model_class_name %>.get(<%= singular_model %>[:id] )
39
+ def update(id, <%= singular_model %>)
40
+ @<%= singular_model %> = <%= model_class_name %>.get(id)
40
41
  raise NotFound unless @<%= singular_model %>
41
42
  if @<%= singular_model %>.update_attributes(<%= singular_model %>)
42
43
  redirect resource(@<%= singular_model %>)
@@ -49,7 +50,7 @@ class <%= class_name %> < Application
49
50
  @<%= singular_model %> = <%= model_class_name %>.get(id)
50
51
  raise NotFound unless @<%= singular_model %>
51
52
  if @<%= singular_model %>.destroy
52
- redirect resource(@<%= plural_model %>)
53
+ redirect resource(:<%= plural_model %>)
53
54
  else
54
55
  raise InternalServerError
55
56
  end
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, edit action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/edit.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/edit.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, index action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/index.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/index.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, new action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/new.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/new.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, show action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/show.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/show.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -9,22 +9,22 @@ namespace :db do
9
9
  end
10
10
 
11
11
  desc "Create a sample database.yml file"
12
- task :database_yaml => :merb_start do
12
+ task :database_yaml => :merb_env do
13
13
  sample_location = File.join(File.dirname(__FILE__), "..", "merb", "orms", "data_mapper", "database.yml.sample")
14
14
  target_location = Merb.dir_for(:config)
15
15
  FileUtils.cp sample_location, target_location
16
16
  end
17
17
  desc "Perform automigration"
18
- task :automigrate => :merb_start do
18
+ task :automigrate => :merb_env do
19
19
  ::DataMapper::AutoMigrator.auto_migrate
20
20
  end
21
21
  desc "Perform non destructive automigration"
22
- task :autoupgrade => :merb_start do
22
+ task :autoupgrade => :merb_env do
23
23
  ::DataMapper::AutoMigrator.auto_upgrade
24
24
  end
25
25
 
26
26
  namespace :migrate do
27
- task :load => :merb_start do
27
+ task :load => :merb_env do
28
28
  gem 'dm-migrations'
29
29
  require 'migration_runner'
30
30
  FileList["schema/migrations/*.rb"].each do |migration|
@@ -81,12 +81,12 @@ end
81
81
 
82
82
  namespace :sessions do
83
83
  desc "Perform automigration for sessions"
84
- task :create => :merb_start do
84
+ task :create => :merb_env do
85
85
  Merb::DataMapperSessionStore.auto_migrate!
86
86
  end
87
87
 
88
88
  desc "Clears sessions"
89
- task :clear => :merb_start do
89
+ task :clear => :merb_env do
90
90
  Merb::DataMapperSessionStore.all.destroy!
91
91
  end
92
92
  end
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module MerbDataMapper
3
- VERSION = "0.9.9"
3
+ VERSION = "0.9.10"
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ if defined?(Merb::Plugins)
2
2
  dependency 'dm-core'
3
3
 
4
4
  require File.dirname(__FILE__) / "merb" / "orms" / "data_mapper" / "connection"
5
+ require File.dirname(__FILE__) / "merb" / "session" / "data_mapper_session"
5
6
  Merb::Plugins.add_rakefiles "merb_datamapper" / "merbtasks"
6
7
 
7
8
  class Merb::Orms::DataMapper::Connect < Merb::BootLoader
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb_datamapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Toy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-14 00:00:00 +03:00
12
+ date: 2008-10-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.9.9
43
+ version: 0.9.10
44
44
  version:
45
45
  description: DataMapper plugin providing DataMapper support for Merb
46
46
  email: jtoy@rubynow.com
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements: []
104
104
 
105
105
  rubyforge_project: merb
106
- rubygems_version: 1.2.0
106
+ rubygems_version: 1.3.0
107
107
  signing_key:
108
108
  specification_version: 2
109
109
  summary: DataMapper plugin providing DataMapper support for Merb