Sep 28, 2008
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / undefined method `password' in users/new.html.erb from p 167

Dave,

At the bottom of p. 167 we mention that the :password_confirmation field is a special attribute that works with the User validation that we add later on. On the top of p. 171 we add attr_accessor :password to the User class. This adds the password attribute to the class so that it will work with the form. If you update your User class to use this attribute, your form should start working again.

Derek

 
Jul 16, 2008
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / Problem with fixtures and tests

Charles,

It looks like your test schema is not up to date with the development schema. Running the 004_add_salt_to_users.rb migration will only apply the migration to the user_group_development database. You’ll want to copy these schema changes to the test database by running the task:

rake db:test:prepare

We briefly discuss this on page 156, but we probably should have mentioned that you need to rerun this task any time you change the development schema to make sure the test database is up to date.

Hope this helps

 
May 5, 2008
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / Errors running methods on page 125

The named routes helper methods aren’t available within top level scope in the console. They are available within the view files (index.html.erb) because Rails automatically includes them as helpers within our controllers and views. To use these methods in the console you need to first include the ActionController::UrlWriter module.

user_group> ruby script/console 
Loading development environment (Rails 2.0.2)
>> include ActionController::UrlWriter
=> Object
>> meeting_path(:id => 1)
=> "/meetings/show/1" 
 
Apr 11, 2008
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / Install the sample code in environment

David,

The rails command does not actually install anything, but instead generates some code snippets to start a new rails project. The user_group_7 directory you downloaded is a rails application in progress. You can view the source code by just opening the files in your text editor. If you want to see the sample rails application running in your browser you can do the following:

1. Move into the user_group_7 directory
2. Use rake db:create to create the database needed (user_group_development)
3. Use rake db:migrate to migrate the database
4. Use ruby script/server to start up the webserver
5. navigate to http://localhost:3000/meetings to view the site

cd user_group_7
rake db:create
rake db:migrate
ruby script/server

There is much more information on this process in the first chapter of the book. If this doesn’t work out for you, paste in a snippet of the error you’re getting, and I’ll try to help.

Thanks,
Derek

 
Feb 22, 2008
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / ruby script/server problem

Dustin,

RubyGems 1.0.1 requires Ruby > 1.8.2. This is probably why it isn’t working correctly. Ruby 1.8.6 is the current recommended version for Rails.

Derek

 
Jan 7, 2008
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / User authentication unit test?

At the top of that page there is a link to submit it

 
Jan 6, 2008
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / User authentication unit test?

John,

We’re glad you’re enjoying the book!

You’re right, it seems we jumped ahead with authentication test. We’ll have to fix that. ActiveSupport::TestCase was recently added to Rails 2.0, and as you’ve seen it doesn’t affect the functionality of the tests shown in the book. We’ll hopefully have these examples updated for the next version.

The second issue you mention is because we meant to show only a section of the users controller on page 179/180, and not the entire controller. That was a mistake on our part, and we’ll have to fix this code example.

Thanks for your feedback! We’ll do our best to address these for the next version. If you find any more errata, feel free to submit them to our errata page for the book.

 
Dec 21, 2007
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / Example application in Ch.1

Daryl,

I’ve only heard of this problem once before, and it was indeed from someone else using Windows. I’ll investigate, and make sure to add a note in the book if this is an issue.

Derek

 
Dec 19, 2007
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / rails database

Leo,

As you found out, this was changed in Rails 2.0.2, which was just released a couple days ago. We plan on updating this in the next beta release, and before it goes to print.

Thanks,
Derek

 
Dec 12, 2007
Derek_small Derek DeVries 10 posts

Topic: Rails for PHP Developers / protect_from_forgery problems with example app in chapter 1

Donal,

Thanks for pointing this out.

As you found out, the error occurs because of the CSRF (Cross-Site Request Forgery) protection added to Rails 2.0. We missed updating this example to account for the CSRF feature when we released the initial beta.

You were on the right track with the hidden “authenticity_token” field, but the preferred way is to use a form helper as you mention. The current beta version of the book (released just a couple days ago), updates the example to do just this. We’ve made this fix along with others, so now is a good time to get the newest version of the beta book in your pragprog account.

Derek

10 posts