# Routes.rb structure

**URL:** https://meta.discourse.org/t/routes-rb-structure/53397
**Category:** Development
**Created:** [2016年十一月26日 13:35 UTC](https://meta.discourse.org/t/routes-rb-structure/53397 "2016-11-26T13:35:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [2016年十一月26日 13:35 UTC](https://meta.discourse.org/t/routes-rb-structure/53397/1 "2016-11-26T13:35:39Z")

</div>

hi  
I have a controller and action but my action don’t render any thing .it just send some json to some where.  
my routs.rb :

```plaintext
get 'recom/recom'
resources :recom do
      member do
          get 'recom/req'
      end
  end

```

and my recom controller:

```plaintext
def index
         render('recom/recom')
   end
    def req
        require 'net/http'
        require 'json'
        uri = URI("http://80.85.203.33:321/ingest?id=1122&url=%27t54646%27");
        req = Net::HTTP::Get.new(uri);
        res = Net::HTTP.start(uri.hostname, uri.port) do |http|
            http.request(req);
        end
    end

```

and my error is:  
The action ‘show’ could not be found for RecomController  
and when I put show function without render it says it couldn’t run blank template.  
when I put render inside of req function .It works fine but I don’t want to render any thing I just want to run a code on every request sent to controller

---

<div class="post-metadata">

### Author: ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)
#### Post date: [2016年十一月26日 15:40 UTC](https://meta.discourse.org/t/routes-rb-structure/53397/2 "2016-11-26T15:40:36Z")

</div>

It sounds like you probably don’t want to be using controller actions then. Controllers are typically middlemen between models and views. Hence they’re expecting you to render _something_, whether that’s html, json or just plain headers.

Have you fully read up on [Routes](http://guides.rubyonrails.org/routing.html) and [Controllers](http://guides.rubyonrails.org/action_controller_overview.html)?

Also, is there a particular reason why you’re defining **recom** as a resource and then using a member route? This will attempt to use the **recom** controller and whatever action is after **get** , in this case ‘recom/req’ which I’m not sure is valid but I may be wrong. It be might be trying to default to the **show** action hence your error.

If you just wanted to provide a path just for the **req** action you could just use

`get 'recom/req', to: 'recom#req'`

Anyway, what relevance does this have to Discourse? 🤔
