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
0
votes
2 answers

Laravel 4 link_to_action

Good afternoon, I'm trying to create a link to run my destroy action. Reading the documentation of Laravel 4, it should perform as follows: link_to_action cast ('@ getIndex HomeController', $ title, $ parameters = array (), $ attributes = array…
cfgv
  • 69
  • 1
  • 8
0
votes
1 answer

Following The Rails getting Started Guide and getting a ActionController::InvalidAuthenticityToken

I'm following the rails getting started guide here: http://guides.rubyonrails.org/getting_started.html I'm on the step 'Creating posts', where I setup my new view to submit a post to my controller. When I click the submit button in the view I get…
0
votes
2 answers

How can I DRY up Rails Controller cache_page if=>proc

Can't help but think there's a way to DRY up this proc a little but across files, but I'm a bit of a ruby n00b and I guess objectifying/exposing/referencing the proc is still out of my grasp conceptually. Is it doable? # controller_1.rb caches_page…
TomFuertes
  • 7,150
  • 5
  • 35
  • 49
0
votes
1 answer

Can't get ActionController::Live to play nice with ActiveSupport::Notifications

I've been looking for ways of triggering server-side events with ActionController::Live without the use of polling. It seems like the only documented pub/sub solution for Live is to use Redis, but I'd really like to just use the stack I currently…
Ten Bitcomb
  • 2,316
  • 1
  • 25
  • 39
0
votes
1 answer

Construct new params to pass permit in Rails

In a web request, my initial params is like this, without including the unrelated part: params = { "base_table"=>{"name"=>"syy", "age"=>"12"}, "tennis_questionaire"=>{"tennis_ball_num"=>"3718"}, "id"=>"1" } I want to put the 'base_table'…
songyy
  • 4,323
  • 6
  • 41
  • 63
0
votes
1 answer

How to execute ApplicationController filters before than resource_from_invitation_token?

I have a multitenancy app and I'm setting the current tenancy like this: class ApplicationController < ActionController::Base around_filter :scope_current_tenancy def scope_current_tenancy Tenancy.current_id = current_tenancy.id if…
0
votes
2 answers

How does Rails know which controller's "show" action to use in this example from Rails Guides?

I'm reviewing the "Rails Routing From The Outside In" section of the Rails Guides, and I came across this section: Sometimes, you have a resource that clients always look up without referencing an ID. For example, you would like /profile to…
Richie Thomas
  • 3,073
  • 4
  • 32
  • 55
0
votes
2 answers

Button points to wrong action in controller

I'm having issues getting a button to point to the correct action in my controller. My show view has the following buttons: <%= button_to "Submit for Approval", {action: "submit", :id => @ecn.id} %> <%= button_to "Close ECN", {action: "close", :id…
sabrams
  • 1,128
  • 2
  • 15
  • 28
0
votes
1 answer

Rails 4.0.0 strong parameters don't seem to work as documented

The example used in the documentation (http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters) for strong parameters is: params.require(:person).permit(:name, :age) However, this doesn't work because require() returns the…
0
votes
4 answers

Stuck completing my first rails app

I was taking a tutorial online on rails but I got stuck. These are my controller and view files: /app/controllers/todos_controller.rb: class TodosController < ApplicationController def index @todo_array = [ "Buy Milk", "Buy Soap", "Pay bill",…
0
votes
3 answers

Issue with Redirect not functioning in Rail 2

I have this redirection in the middle of my controller so if something isn't there, it will redirect you to a new area of the site if needed. Here is the problem. It is just ignoring the redirect in the code. It looks like this. if conditions …
Red
  • 2,256
  • 5
  • 25
  • 38
0
votes
2 answers

Routing error for no route matches when action is clearly in controller

I think it is a routing issue where the controller is not matched properly. I am confused because there is clearly a new action in my ComicTitlesController. Here is the error I receive when I load the home page, which has the…
Jayway
  • 95
  • 2
  • 8
0
votes
1 answer

Rendering Error Messages in Rails Form with Javascript

I've got a form that should render error messages but I'm not sure how to render the error messages since my form is being displayed with Javascript after clicking a button. I'm using Devise for the registration which is working just not displaying…
DaveG
  • 1,203
  • 1
  • 25
  • 45
0
votes
1 answer

Redirecting from new function in a resource controller

I'm new to Ruby on Rails. I've seen that in a resources_controller file in whenever you call resources#new it lands me to new.html.haml file which contains a form. When I click on Submit button it redirects to me the the create function of the above…
Joy
  • 4,197
  • 14
  • 61
  • 131
0
votes
1 answer

Rails refactor: Duplicate code in some controllers. Where does it belong?

I have similar (duplicate?) code appearing in a few controllers. Sometimes it's in the #update action, sometimes it's in an #update_multiple action...and sometimes it's in both. In all cases it's code that's primary purpose is to set the belongs_to…
Meltemi
  • 37,979
  • 50
  • 195
  • 293