new plugin - help
Added by marco balatresi almost 14 years ago
Hello everyone,
I am a new user and would like to learn RoR and Redmine making simple practice.
I would write a very simple plugin where a user enters first name and second name. These data are saved on the db.
Can you show me the correct code in "app/views" to create a user form that captures the data entered? and instructions for "app/controller" save the data?
I tried to find on the API of RoR, but I had no results.
sorry for the strange request, thank you very much
Replies (1)
RE: new plugin - help - Added by marco balatresi almost 14 years ago
I had implemented this code:
app/views/inizializza
<h2>Prova#inizializza</h2> <h3>Aggiungi un nuovo messaggio</h3> <form action="inserisci" method="post"> Nome: <%= text_area_tag "nome" %> <br /> Cognome: <%= text_area_tag "cognome" %> <br /> <%= submit_tag("Submit") %> </form>
app/viws/index
<h2>Prova#index</h2>
<% @prova.each do |prov| %>
<p>
<%= link_to 'Insert Data', :action =>'inizializza'%>
<p>
<%= link_to 'Find Data', :action =>'cerca', :id => prov[:id] %>
</p>
<% end %>
app/controller
class ProvaController < ApplicationController unloadable def index @prova = Prov.find(:all) end def inserisci(nome, cognome) @prova = Prov.new @prova.create(:nome=>params['nome'], :cognome=>params['cognome']) if message.save flash[:notice] = 'Ok' redirect_to(:index) end end def inizializza end
When i click on submit the output show this message: Invalid form authenticity token
Someone can help me?
Thank you very much