Skip to content

Instantly share code, notes, and snippets.

@jason
Created July 11, 2012 14:56
Show Gist options
  • Save jason/3090943 to your computer and use it in GitHub Desktop.
Save jason/3090943 to your computer and use it in GitHub Desktop.
Not loading form_for inside of rails console? Also might be reason why my test is failing
➜ sample_app git:(sign-up) ✗ rails c
Loading development environment (Rails 3.2.6)
irb(main):001:0> require "capybara/rails"
=> true
irb(main):002:0> include Capybara::DSL
=> Object
irb(main):003:0> include Rails.application.routes.url_helpers
=> Object
irb(main):005:0> visit signup_path
=> nil
irb(main):006:0> fill_in "Name", with: "Example User"
Capybara::ElementNotFound: cannot fill in, no text field, text area or password field with id, name, or label 'Name' found
<pre><code>In order to use #url_for, you must include routing helpers explicitly. For instance, `include Rails.application.routes.url_helpers</code></pre>
<p>Extracted source (around line <b>#5</b>):
</p>
<pre><code>2: h1 Sign up
3: .row
4: .span6.offset3
5: = form_for(@user) do |f|
6: = render 'shared/error_messages'
7: = f.label :name
@plehoux
Copy link

plehoux commented Dec 11, 2012

Did you solve your problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment