New to RoR and databasedotcom gem, listing contacts example doesn't work

107 views
Skip to first unread message

tcash21

unread,
Oct 31, 2012, 6:44:01 PM10/31/12
to activesa...@googlegroups.com
Hi all,

I apologize for my lack of Ruby on Rails knowledge, I've been reading the Agile Development book for the past few days. I'm now trying out an example here to list and display users:
http://wiki.developerforce.com/page/Accessing_Salesforce_Data_From_Ruby

The error I am receiving when navigating to http://localhost:3000/users is:
undefined method `sfdc_models_user_path' for #<#<Class:0x007fdcdefe6100>:0x007fdcdefd9b08>

I've successfully used the gem in a ruby console though.

Here is my code:

views/users/index.html.erb
<h1>Users</h1>

<% @users.each do |u| %>
<%= link_to "#{u.Name}", u %><br/>
<% end %>

views/users/show.html.erb
<h1>User <%= @user.Name %></h1>

<% @user.attributes.each do |a| %>
<%= a[0] %>: <%= a[1] %><br/>
<% end %>

controllers/users_controller.rb
class UsersController < ApplicationController
include Databasedotcom::Rails::Controller

def index
@users = User.all()[0..19]
end

def show
@user = User.find(params[:id])
end
end

And I added the following line to config/routes.rb
resources :users

Please help!


Marina S. Martin

unread,
Nov 2, 2012, 10:05:29 PM11/2/12
to activesa...@googlegroups.com
Did you restart the server after updating your routes.rb file?







--
You received this message because you are subscribed to the Google Groups "ActiveSalesforce" group.
To view this discussion on the web visit https://groups.google.com/d/msg/activesalesforce/-/wB_YdaGKtY8J.
To post to this group, send email to activesa...@googlegroups.com.
To unsubscribe from this group, send email to activesalesfor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/activesalesforce?hl=en.


Mason Jones

unread,
Nov 2, 2012, 10:56:06 PM11/2/12
to activesa...@googlegroups.com
Right, that's what the problem looks like to me as well. That error "undefined method `sfdc_models_user_path'" means that it's trying to find the route for that path. If you do a "rake routes" it will list out the routes defined in your routes.rb and you can verify that the path is there. If so, then restart your server and it should then find it.
Reply all
Reply to author
Forward
0 new messages