I'm trying create a application with both active and neo4j models, and I want to use the following for my neo4j models:
module Neo
class Usernode
include Neo4j::ActiveNode
property :first_name, type: String
property :last_name, type: String
property :address, type: String
end
end
And use them in my controller as the following:
class UsernodesController < ApplicationController
def index
@usernodes = Neo::Usernode.all
end
in my routes.db file I have the following route for this:
Rails.application.routes.draw do
resources :usernodes, path: '/usernodes'
end
The problem with this is that it only produces routes that has '/neo/usernodes/'
, and I only want to use routes with '/usernodes/'
.
Is it possible to product only '/usernodes/'
? If yes, how can I do that?
then if I use in routes.db:
resources :usernodes, path: '/usernodes'
I get the following error:
Processing by UsernodesController#new as HTML
Rendered usernodes/_form.html.erb (12.2ms)
Rendered usernodes/new.html.erb within layouts/application (12.7ms)
Completed 500 Internal Server Error in 15ms
ActionView::Template::Error (undefined method 'neo_usernodes_path' for
#<#<Class:0x0000000788e968>:0x000000089f3c08>):
1: <%= form_for(@usernode) do |f| %>
2: <% if @usernode.errors.any? %>
3: <div id="error_explanation">
4: <h2><%= pluralize(@usernode.errors.count, "error") %> prohibited this usernode from being saved:</h2>
this is my routes:
Prefix Verb URI Pattern Controller#Action
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
usernodes GET /usernodes(.:format) usernodes#index
POST /usernodes(.:format) usernodes#create
new_usernode GET /usernodes/new(.:format) usernodes#new
edit_usernode GET /usernodes/:id/edit(.:format) usernodes#edit
usernode GET /usernodes/:id(.:format) usernodes#show
PATCH /usernodes/:id(.:format) usernodes#update
PUT /usernodes/:id(.:format) usernodes#update
DELETE /usernodes/:id(.:format) usernodes#destroy
Please try below: