Hi I´m new in ruby on rails. I´ve written a plugin in redmine. And add this plugin to projects tab. I need to show something in that new tab, and edit the data. But now, I have 2 problems: 1. In the new tab, when I click on the Edit link, the edit page open in the new page out of projects tab. 2. In the new page, data get from database correctly and show correctly, but when I want to update data, show the error: Page not found
here is my code: /config/routes.rb : get 'accounts', :to => 'accounts#index' post 'post/:id/edit', :to => 'accounts#edit' post 'post/:id/update', :to => 'accounts#update' /app/controller/accounts_controller.rb: class AccountsController < ApplicationController unloadable def index @project = Project.find(params[:project_id]) @accounts = Account.find(:all) end def edit @account = Account.find(params[:id]) end def update @account = Account.find(params[:id]) if @account.update_attributes(params[:account]) redirect_to :action => 'edit', :id => @account else redirect_to :action => 'edit', :id => @account end end end /app/views/accounts/index.html.erb: <h2>AccounstController</h2> <% @accounst.each do |account| %> <table border=1px> <% if account.project.to_s == @project.to_s then %> <% @id = account.id %> <tr> <td display=inline-block>Project name</td> <td><%= account.project %></td> </tr> <tr> <td display=inline-block>Cost</td> <td><%= account.cost %></td> </tr> <tr> <td display=inline-block>Income</td> <td><%= account.income %></td> </tr> <tr> <td display=inline-block>Factor</td> <td><%= account.factor%></td> </tr> <% end %> </table> <% end %> <%= link_to "Edit", {:action => 'edit', :id => @id } %> /app/views/accounts/edit.html.erb: <h1>Editing account </h1> <%= form_tag :action => 'update', :id => @account do %> <p><label for="account_cost">Cost</label>: <%= text_field 'account', 'cost' %></p> <p><label for="account_factor">Factor</label>: <%= text_field 'account', 'factor' %></p> <p><label for="account_income">Income</label>: <%= text_field 'account', 'income' %></p> <%= submit_tag "save changes" %> <% end %> <%= link_to 'Back', {:action => 'index'} %> Can anyone help me please? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e434944a-7ecd-4bc1-807d-4a919efc7493%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.