Comments (10)
Just to check the obvious first, you haven't used e.g. /admin/foo
in the prefix
option to the simple_crud(...)
call, right?
from dancer-plugin-simplecrud.
Right, no I haven't ;) sorry about leaving that out.
from dancer-plugin-simplecrud.
The load_app + prefix combo adds the prefix to every post/get/etc inside the loaded file.
from dancer-plugin-simplecrud.
Actually if I'm reading the Dancer source code correctly the current prefix is added to every get/post/etc, so I don't know why you'd need to include $args{dancer_prefix} in those.
from dancer-plugin-simplecrud.
There's a little confusion between the prefix
argument to simple_crud(...)
and Dancer prefix settings. The former is just what the URLs to edit stuff in that table will start with; if there's a Dancer prefix in effect, it will be prepended.
So, let's say you're using the example app shipped with the module - it's editing records in the people
table, so it uses prefix => '/people'
. This means that listing records will be at /people
, editing a record will be at /people/edit/:id
, etc. However, if there's a Dancer prefix
setting in effect, then it will be prepended - so, if say the Dancer prefix is /foo
, then listing people will now be at /foo/people
.
Does that help clarify things? Is that what's going on?
from dancer-plugin-simplecrud.
When you register a route (like post, get or any) it (Dancer::Route) add's the dancer prefix to the route, if you add it to your route in your plugin it's added twice. Just removed the $args{dancer_prefix} from the get/post and any in sub simple_crud and my program works again. I really can't see how it has worked for anyone using prefix.
from dancer-plugin-simplecrud.
Hi bigpresh,
I was about to report the exactly the same issue before happened to find out that xvaara already did here. Not only I tested with an applicaiton, but also I have the same conclusion with xvaara about the reason after having read the code.
There are a couple of options. Right now I get around the problem by using "prefix undef;" instead of "prefix '/admin'", then inside the βsimple_crud(β, I use " prefix => '/admin/files'". It works.
I could also modify "_construct_url()" but it is called in quite a few places. I might mess up the code. You understand more about this module.
Thank you guys for this very useful module anyway.
from dancer-plugin-simplecrud.
I add
prefix "foo";
to simplecrud-example.pl, It's not work out as desc of documents, "/foo/people" can not list the records from database.
When I change /foo/people to /foo/foo/people i get the records
from dancer-plugin-simplecrud.
@bigpresh is this still an issue?
from dancer-plugin-simplecrud.
Wow, er, this sat for quite some time. Sorry!
Yes, I can confirm the behaviour, and also confirm that removing the use of $args{dancer_prefix}
when constructing route paths to pass to get
, post
etc, and leaving it just to be used to formulate URLs for links in the templates, does indeed solve the problem.
from dancer-plugin-simplecrud.
Related Issues (20)
- Editing record 0 doesn't pre-populate existing data
- make test generates warnings
- bug: auth-protected simple_crud with auth enabled allows open access to /objects/edit/:id HOT 2
- feature: auth tests
- intermittent errors on GET '/item/add' route HOT 1
- New where_filter stuff doesn't go far enough HOT 3
- custom_columns feature request HOT 6
- custom_column definitions change display order HOT 2
- D:P:SC auth causes lots of repeated SQL queries HOT 4
- customizing content in data cells HOT 9
- feature request: /table/add form values default to param values HOT 2
- /table/add form confusing with labels and foreign keys HOT 2
- Locking issue in the testsuite HOT 1
- simplecrud interfaces don't allow addable without editabilty, and vice versa HOT 2
- crud interfaces don't allow deletability without editabilty HOT 3
- feature: use custom_column information in /table/view/:id routes
- feature: show information about row being deleted
- custom columns can cause 'setSectionColClass: Invalid table reference' to output to STDERR
- Doesn't find database config? [ not "Plugging in" properly? ] HOT 2
- Feature: work with Dancer2 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dancer-plugin-simplecrud.