开发者

Rails Controller Models Naming Convention Problem

开发者 https://www.devze.com 2023-03-31 05:07 出处:网络
I am a newbie to Ruby on Rails and trying to setup oracle based ROR application, The DB table name is booker.live_edi_vendors

I am a newbie to Ruby on Rails and trying to setup oracle based ROR application,

The DB table name is booker.live_edi_vendors

I have my controller defined in the following path:

../rails-root/app/controller/live_edi_vendors_controller.rb

And the content is:

 class LiveEdiVendorsController < ApplicationController
    def index
      @name = request.env['REMOTE_USER']
    end
 end

I also created a view for this controller, which is in ../rails-root/app/views/live_edi_vendors folder.

And I have put some code in index.html.erb inside this directory.

Now, my model file is ../rails-root/app/model/live_edi_vendors.rb

and the content in this file is:

class LiveEdiVendors < ActiveRecord::Base
      set_primary_key "live_edi_vendor_id"
      set_table_name "booker.live_edi_vendors"

      def LiveEdiVendors.find_by_legal_entity_id(legal_entity_id)
          return "asdadsad" #testing (temporary)
      end
  end

Now,

When i am trying to access the path <website host>/live_edi_vendors from browser, it says

uninitialized constant LiveEdiVendorsController

My routes.rb file is having the following line to route the request:

map.vendorlivelist 'live_edi_vendors/:action', :controller => 'live_edi_vendors'

Please, help me out, I struggling with these naming conventions a lot these days.

I am also putting my directory structure here:

app
|-- controllers
|   `-- live_edi_vendors_controller.rb
|-- model
|   `-- live_edi_vendors.rb
`-- views
    |-- layouts
    `-- live_edi_vendors
        `-- index.html.erb

Th开发者_如何转开发anks,


hmm Model name are always singular try

class LiveEdiVendor < ActiveRecord::Base
  ....
end

and model file name too

live_edi_vendor.rb
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号