dust-generators 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dust/version.rb +1 -1
- data/rails_generators/dust_scaffold/templates/actions/create.rb +1 -1
- data/rails_generators/dust_scaffold/templates/actions/destroy.rb +1 -1
- data/rails_generators/dust_scaffold/templates/actions/update.rb +1 -1
- data/rails_generators/dust_scaffold/templates/fixtures.yml +2 -2
- data/rails_generators/dust_scaffold/templates/migration.rb +1 -1
- data/rails_generators/dust_scaffold/templates/model.rb +2 -2
- metadata +3 -3
data/lib/dust/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
def create
|
2
2
|
@<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
|
3
3
|
if @<%= singular_name %>.save
|
4
|
-
flash[:notice] = "Successfully created <%=
|
4
|
+
flash[:notice] = "Successfully created <%= name.underscore.humanize.downcase %>."
|
5
5
|
redirect_to <%= item_path('url') %>
|
6
6
|
else
|
7
7
|
render :action => 'new'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
def destroy
|
2
2
|
@<%= singular_name %> = <%= class_name %>.find(params[:id])
|
3
3
|
@<%= singular_name %>.destroy
|
4
|
-
flash[:notice] = "Successfully destroyed <%=
|
4
|
+
flash[:notice] = "Successfully destroyed <%= name.underscore.humanize.downcase %>."
|
5
5
|
redirect_to <%= items_path('url') %>
|
6
6
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
def update
|
2
2
|
@<%= singular_name %> = <%= class_name %>.find(params[:id])
|
3
3
|
if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
|
4
|
-
flash[:notice] = "Successfully updated <%=
|
4
|
+
flash[:notice] = "Successfully updated <%= name.underscore.humanize.downcase %>."
|
5
5
|
redirect_to <%= item_path('url') %>
|
6
6
|
else
|
7
7
|
render :action => 'edit'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
one:
|
2
|
-
<%- for attribute in
|
2
|
+
<%- for attribute in attributes -%>
|
3
3
|
<%= attribute.name %>: <%= attribute.default %>
|
4
4
|
<%- end -%>
|
5
5
|
|
6
6
|
two:
|
7
|
-
<%- for attribute in
|
7
|
+
<%- for attribute in attributes -%>
|
8
8
|
<%= attribute.name %>: <%= attribute.default %>
|
9
9
|
<%- end -%>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Create<%= plural_class_name %> < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
create_table :<%= plural_name %> do |t|
|
4
|
-
<%- for attribute in
|
4
|
+
<%- for attribute in attributes -%>
|
5
5
|
t.<%= attribute.type %> :<%= attribute.name %>
|
6
6
|
<%- end -%>
|
7
7
|
<%- unless options[:skip_timestamps] -%>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class <%= class_name %> < ActiveRecord::Base
|
2
|
-
attr_accessible <%=
|
2
|
+
attr_accessible <%= attributes.map { |a| ":#{a.name}" }.join(", ") %>
|
3
3
|
|
4
|
-
<%- first_attribute =
|
4
|
+
<%- first_attribute = attributes.first -%>
|
5
5
|
def self.page(search, page)
|
6
6
|
paginate :per_page => 10, :page => page,
|
7
7
|
:order => 'name',
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dust-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- rossnelson
|