routes

rails 3 removing controller name form url

穿精又带淫゛_ 提交于 2019-12-13 21:15:18
问题 I'm trying to set up some semistatic page in a rails 3 app I've created a Pages controller with some non restful actions class PagesController < ApplicationController def home end def about end def contact end def monday end def saturday end def sunday end end It's showing at /pages/home etc. Is there a way to re-route the pages so that they show under /home etc. I've tried resources :pages, :path => '/' do #blah end but I get an error message telling me that the :action => show is missing.

Rails routes base on model attributes

谁说胖子不能爱 提交于 2019-12-13 21:13:05
问题 with reference to Rails url options based on model attribute, I have a proposed solution but I am not sure if this is the way to proceed. I am also looking to create routes based on model's attributes for seo purpose. Here it goes. I have a business models, and the routes generated is /businesses/id . With friendlyid gem, it becomes businesses/slug However, I want the route to become /business-type/business-name-and-address for example. So with reference to Code Connoisseur's blog # app

Symfony 4 404 Page not found on all routes except root

大城市里の小女人 提交于 2019-12-13 21:00:58
问题 I have installed symfony 4 on my shared hosting. My structure is like this: ROOT | |-- public_html | |-- tst |-- tst | |-- bin |-- config |-- src |-- translations |-- var |-- vendor |-- composer.json |-- composer.lock |-- binsymfony.lock I moved index.php from the public folder to the public_html/tst folder and changed the paths inside that file to match the new structure: require __DIR__.'/../../tst/vendor/autoload.php'; Now, when running http://mysite/tst, I get the homepage of the site as

Mass 301 redirects in Rails 3

别来无恙 提交于 2019-12-13 19:57:59
问题 We've built up thousands of product urls while using Magento as our cart application and these URLs are not at all intuitive or that SEO friendly, despite having built up our search rankings on them. We are transitioning to Rails 3 (with Spree as our cart) and would like to clean up our URLs. I'm wondering what's the cleanest way to handle potentially thousands of 301 redirects in Rails? Hard coding that many in routes.rb does not seem sane. Possibly pertinent info: We're tied to using Heroku

Rails 3 integration test mangles (model)_path(@instance) helper

旧城冷巷雨未停 提交于 2019-12-13 18:56:55
问题 I have a Doc class with the standard routes created by the scaffold generator. In the code, I use docs_path(@doc) # => /docs/7 which works fine. In my integration test I use: get docs_path(@doc) #=> /docs.7 which does not work at all fine. This is the same for other controllers that are using the standard routes for rails models. Using: get "/docs/7" in the integration test code works fine, but when I it tries to process a page using a '_path' or '_url' helper, then it mangles those in a

Ajax check for database change using route

喜你入骨 提交于 2019-12-13 18:28:40
问题 I'm using Paperclip with Delayed::Job to process photos in the background. When processing is done, the model should set photo.attachment_is_processing to false. I need to check for this change on the client side. I understand I can do this by querying a route using Ajax, however: How should the route look like? Possible clues from schema.rb : create_table "forem_posts", force: :cascade do |t| t.integer "topic_id" t.text "text" t.integer "user_id" t.datetime "created_at" t.datetime "updated

Kohana 3 Routing and Query Strings

久未见 提交于 2019-12-13 18:22:43
问题 If I have a route like this: Route::set('test', 'test') ->defaults(array( 'controller' => 'test', 'action' => 'index' )); I assumed that only the url mysite.com/test or mysite.com/test/ would be sent to this route and anything else would be sent to the default route, or a catch all route if you have one. However, you can tack on any query strings and it will still be valid. For example any of these would work: mysite.com/test/?abc mysite.com/test/?abc=123 mysite.com/test/?abc=123&blabla=lala

How to set language (locale) inside a Route::group()… in Laravel 5.4?

扶醉桌前 提交于 2019-12-13 18:12:53
问题 Inside blade - welcome.blade.php . <div class="links"> <a href="https://laravel.com/docs">{{ __('passwords.reset') }}</a> </div> Inside web.php . If I run: Route::get('/', function () { return view('welcome'); }); I get the correct welcome blade page with the correct translation. Another Route: Route::get('welcome/{lang}', function ($lang) { // echo $lang; // dd(Lang::getLocale()); App::setLocale($lang); //dd(Lang::getLocale()); return view('welcome'); // }); If I run dd(Lang::getLocale()); I

Protecting post routes NodeJS

帅比萌擦擦* 提交于 2019-12-13 18:09:09
问题 I am working on a nodeJS application. So far i've learned you can protect routes with JWT and i've implemented this. The problem is, I am not sure how to protect a route where the user is allowed to post to. Let's take a register route for example, this route will be used for user registration. I want users to be able to post to this, BUT only from my application. I dont want anyone to just be able to connect to it via postman and post whatever. How do you protect these kind of routes. Thanks

Codeigniter: All Arabic routes are not working

元气小坏坏 提交于 2019-12-13 17:22:54
问题 [Update] Added to the config but still not working $config['permitted_uri_chars'] .= '%D8%A2%D8%A7%D8%A8%D9%BE%D8%AA%D8%AB%D8%AC%DA%86%D8%AD%D8%AE%D8%AF%D8%B0%D8%B1%D8%B2%D8%B3%D8%B4%D8%B5%D8%B6%D8%B7%D8%B8%D8%B9%D8%BA%D9%81%D9%82%DA%A9%DA%AF%D9%84%D9%85%D9%86%D9%88%D9%87%DB%8C%D9%8A%DB%B1%DB%B2%DB%B3%DB%B4%DB%B5%DB%B6%DB%B7%DB%B8%DB%B9%DB%B0'; $config['charset'] = 'UTF-8'; //by default I have updated Codeigniter from 2.1 to 2.2 then to 3. The issue I have is in the routes in Arabic