Skip to content

Commit

Permalink
initial commit - fix editing and updating in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesarobbo committed Nov 7, 2014
1 parent c1624d7 commit cd4f666
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions .ruby-gemset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix_me_app
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-1.9.3-p550
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ group :development, :test do
gem "rspec-rails"
end


# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/administration/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def update

respond_to do |format|
if @category.update_attributes(params[:category])
format.html { redirect_to @category, notice: 'Category was successfully updated.' }

# add path helper
format.html { redirect_to administration_category_path(@category), notice: 'Category was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/administration/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def update

respond_to do |format|
if @product.update_attributes(params[:product])
format.html { redirect_to @product, notice: 'Product was successfully updated.' }

# add path helper
format.html { redirect_to administration_product_path(@product), notice: 'Product was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/administration/variants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def update

respond_to do |format|
if @variant.update_attributes(params[:variant])
format.html { redirect_to @variant, notice: 'Variant was successfully updated.' }

# add path helper
format.html { redirect_to administration_variant_path(@variant), notice: 'Variant was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
Expand Down
3 changes: 2 additions & 1 deletion app/views/administration/categories/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%= form_for(@category, :url => administration_categories_path) do |f| %>
<!-- amend URL -->
<%= form_for(@category, :url => administration_category_path) do |f| %>
<% if @category.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@category.errors.count, "error") %> prohibited this category from being saved:</h2>
Expand Down
3 changes: 2 additions & 1 deletion app/views/administration/products/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%= form_for(@product, :url => administration_products_path) do |f| %>
<!-- amend URL -->
<%= form_for(@product, :url => administration_product_path) do |f| %>
<% if @product.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@product.errors.count, "error") %> prohibited this product from being saved:</h2>
Expand Down
3 changes: 2 additions & 1 deletion app/views/administration/variants/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%= form_for(@variant, :url => administration_variants_path) do |f| %>
<!-- amend URL -->
<%= form_for(@variant, :url => administration_variant_path) do |f| %>
<% if @variant.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@variant.errors.count, "error") %> prohibited this variant from being saved:</h2>
Expand Down
4 changes: 2 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ test: &test
adapter: mysql2
database: ms_fix_me_app_test
encoding: utf8
username: msdev
password: password
username:
password:
host: localhost

cucumber:
Expand Down

0 comments on commit cd4f666

Please sign in to comment.