Skip to content

Commit

Permalink
for new and update use model.id
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Singh committed Oct 8, 2011
1 parent 960368d commit cf6ae61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin_data/crud_controller.rb
Expand Up @@ -45,7 +45,7 @@ def update
if @model.update_attributes(model_attrs)
format.html do
flash[:success] = "Record was updated"
redirect_to admin_data_path(:id => @model, :klass => @klass.name.underscore)
redirect_to admin_data_path(:id => @model.id, :klass => @klass.name.underscore)
end
format.js { render :json => {:success => true}}
else
Expand All @@ -67,7 +67,7 @@ def create
else
format.html do
flash[:success] = "Record was created"
redirect_to admin_data_path(:id => @model, :klass => @klass.name.underscore)
redirect_to admin_data_path(:id => @model.id, :klass => @klass.name.underscore)
end
format.js { render :json => {} }
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin_data/crud/edit.html.erb
Expand Up @@ -12,7 +12,7 @@

<div class="content rounded">
<div class="inner umbrella">
<% url = admin_data_path(:klass => @klass.name, :id => @model)
<% url = admin_data_path(:klass => @klass.name, :id => @model.id)
html_options = {:class => 'form', :method => :put} %>
<%= form_for @model, :as => @klass.name.underscore.to_sym, :url => url, :html=> html_options do |f| %>
<%= render 'admin_data/shared/flash_message', :model => @model %>
Expand Down

0 comments on commit cf6ae61

Please sign in to comment.