Hi, I'm trying to use Data Mapper 0.10.2 in a rails 2.3.5 app with a
few legacy tables.  I have a few reserved words as column names, I
only need access to a few columns so listed them as 'property,' and
class works fine in script/console, and in unit tests.  When I try to
load a URL for a controller action, I get an unusual error:

---
 Showing app/views/things/index.html.erb where line #13 raised:

undefined method `thing__path' for #<ActionView::Base:0x7f17e23a8af8>

Extracted source (around line #13):

10:     [td]<%=h thing.name %>[/td]
11:     [td]<%= link_to 'Show', thing %>[/td]
12:     [td]<%= link_to 'Edit', edit_thing_path(thing) %>[/td]
13:     [td]<%= link_to 'Destroy', thing, :confirm => 'Are you
sure?', :method => :delete %>[/td]
14:   [/tr]
15: <% end %>
16: [/table]
---

'Thing' is a simple AR scaffold class I made for this example:
---
  create_table "things", :force => true do |t|
    t.string   "name"
    t.datetime "created_at"
    t.datetime "updated_at"
  end
---
My Data Mapper class (app/models/user.rb):
---
require 'dm-core'

DataMapper.setup(:default, FILTERED)

class User
        include DataMapper::Resource
        storage_names[:default] = 'user'
        property :user_id, Serial
        property :company, String
end
---
my controller (app/controllers/things_controller.rb):
---
  def index
    @things = Thing.all

    # load one DataMapper object
    @user = User.first

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @things }
    end
  end
---

I have been able to reproduce this in passenger 2.2.11, and WEBrick
(script/server).  If I comment out the User.first line and restart
controller action works.  If I put it back action breaks.

/things/show/1 or /new works fine, seems to have something to do with
routes generated by map.resources?

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to