Questions tagged [actioncontroller]

ActionController is the main controller class in Ruby on Rails.

ActionController is the main controller class in Ruby on Rails.

424 questions
3
votes
2 answers

Set a before action to all member routes?

Playing around with Rails 4, I noticed that it defines a before_action filter set_[model], that is called for the actions show, edit, update and destroy. It is in fact very useful, but I don't see much sense in not having it to all member actions.…
fotanus
  • 19,618
  • 13
  • 77
  • 111
3
votes
1 answer

I got Routing Error in ActionController until restart rails server

I want to include module MultipartForm to ApplicationController to extend some functionality for all controllers with methods from this module. Every time I made a change in any controllers in app I got this error. So I have to restart my app. Then…
wiseland
  • 1,010
  • 9
  • 16
3
votes
2 answers

How do I add an additional field to a form via AJAX in rails 4?

I'm on Rails 4. Let's say I have three models: House, Color, and HouseColoring. class House < ActiveRecord::Base has_many :house_colorings has_many :colors, through: :house_colorings accepts_nested_attributes_for :house_colorings,…
oobie11
  • 723
  • 1
  • 8
  • 20
3
votes
1 answer

ActionController::Live + Redis issue

I'm in the process of developing a Rails app which uses ActionController::Live, and the action in that controller is set to subscribe to Redis Pub/Sub. It's pretty much the same method described here -…
3
votes
1 answer

uninitialized constant -- model within controller

I have an application in which a club has_many locations. Clubs & their locations can only be edited within an admin namespace. I am trying to pre-load the club into the controller so that all actions deal with that club only. The routes are nested;…
Steph Rose
  • 2,126
  • 3
  • 23
  • 35
3
votes
2 answers

Rails: Include module, but maintain module name?

Consider this code module Auth def sign_in(user) #some stuff session[:user_id] = user.id end end Now, I want to include this in my application controller. ApplicationController < ActionController::Base include Auth end This makes…
Niels B.
  • 5,912
  • 3
  • 24
  • 44
3
votes
1 answer

Getting around dots in "pretty urls"

In my routes.rb I've got: map.connect ':name', :controller => 'my_classes', :action => 'show' And that works perfectly, so a url like this sends params like so: http://localhost:30000/awesome Parameters:…
Ryan Florence
  • 13,361
  • 9
  • 46
  • 63
3
votes
1 answer

assert_select to test raw or html_safe unescaped content

In a Rails 3.2.8 controller test, I'd like to use an assert_select to control the content an unescaped field rendered in my view using the raw or the #html_safe method :
<%= raw @doc.summary %>
But in my test, both…
3
votes
3 answers

Routing Error No route matches {:action=>"show"

I only have 2 weeks learning ruby on rails, in my app the users can register their cars, from their profile (code below) the app sent to the registration cars page,

<%= @user.email %>

Asantoya17
  • 4,465
  • 6
  • 23
  • 29
3
votes
1 answer

Change log level for single controller or action in rails

We are running a rails project behind haproxy. There is a keep-alive sent to the application every second. This is causing very noisy log files which makes it a bit of a pain to dig through and is making them unnecessarily large. My first thought…
Geoff Lanotte
  • 7,490
  • 1
  • 38
  • 50
2
votes
0 answers

In rails, the controller.action_methods returns methods even if they have no associated routes

For resourceful controllers, calling the controller.action_methods is yielding all the possible action methods on the controller. I have a resource for which I have restricted the routes to [:only=> "index"]. I am looking for a method similar to…
Tabrez
  • 3,424
  • 3
  • 27
  • 33
2
votes
2 answers

How can I monitor an ActionController::Metal with NewRelic?

I have a Rails 3 application of which some controllers are normal rails controllers and some are implemented using ActionController::Metal. By default, NewRelic monitors the normal rails controllers but not the NewRelic ones. It seems that NewRelic…
lacker
  • 5,470
  • 6
  • 36
  • 38
2
votes
1 answer

Undefined method 'url_for' while rendering a Rails 2.3.x template inside a ActiveRecord model

I know that this not an "acceptable" practice but as a background process I am caching a rendered Rails partial into the database for faster output via JSONP. I have found many resources on the topic and successfully output a Rails 2.3.x partial…
ACuppy
  • 21
  • 1
  • 4
2
votes
0 answers

ActionController::ParameterMissing (param is missing or the value is empty: matatu) ruby on rails

I recently started learning ruby on rails and I have been working on a public transport rating app API. Rails 6.0.3.2 I can't seem to shake off this error, I checked other questions but nothing is working for me kindly help me out. Here is the…
kahuria00
  • 317
  • 1
  • 5
  • 14
2
votes
1 answer

Error Rendering with Nested Routes

I am trying to maintain a pretty URL when having a user messaging with failed validation. I have a routes file that looks like the following: # For logged users convenience # example.com/messages # instead of:…
Ben Orozco
  • 4,361
  • 4
  • 33
  • 49