I have a controller called mystuff_controller.rb, a db called mpstuff
and a table inside that db called data and a column called m1. I was
hoping that some could give a quick step by step on how to create a post
action so that I can write input from my index.html.erb form to that
column.
Thanks in advance
Mark P. wrote:
I have a controller called mystuff_controller.rb, a db called mpstuff
and a table inside that db called data and a column called m1. I was
hoping that some could give a quick step by step on how to create a post
action so that I can write input from my index.html.erb form to that
column.
Thanks in advance
mystuff (controller)
class MystuffController < ApplicationController
def index
@my = Mystuff.find(:all)
end
def new
@post = Mystuff.new
respond_to do |format|
format.html #new.html.erb
format.xml { render :xml => @post }
end
end
index.html.erb (view)
includes this line
<%= link_to ‘New post’, new_post_path %>
I get this error
undefined local variable or method `new_post_path’ for
#ActionView::Base:0x384e54c
Extracted source (around line #79):
76:
77:
78:
79: <%= link_to ‘New post’, new_post_path %>
80:
81:
82:
Thanks in advance