I’m studing Ruby on Rails with the “RoR Bible” by Thimothy Fisher. But one of the examples doesn’t work. It’s code – http://pastebin.com/gtjLsdt0
The error is: NoMethodError in Contact#new where line #4 raised:
undefined method `merge' for "first_name":String
that’s my contact_controller. I’m just retyping example’s code, and there weren’t any words about merge
class ContactController < ApplicationController
def index
@contacts = Contact.find(:all);
end
def show
end
def new
@contact = Contact.new;
end
def create
end
def update
end
end
What is wrong??
Lol that example is completely wrong!
Instead of writing sth like this:
You should write
Because by using
f.field_typeyou assign the field to the:contactform which provides thefmethods by iteration! Also you can writeInstead of writing it manual!
// I loked up the book you refered it seems to be quit outdated. You may buy “The Rails 3 Way” or sth. that can hold up to the current rails version!