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
1 answer

Rails form for multiple objects, ActionController UrlGenerationError

Problem with routing in a rails form_tag for collection of items ActionController::UrlGenerationError Goal: I have an array of movies that I show on movies#index page. I have created a movie_vote relationship between movies and users, and want to…
pigate
  • 351
  • 1
  • 7
  • 16
0
votes
1 answer

I'm getting No route matches [DELETE] with custom action and routes in ruby on rails

I have a show page which lists all objects in my DB. I have a delete link that sends the ID of that object to the destroy method in the associated controller and I can then easily delete that object and redirect back to the show page. On the same…
LondonGuy
  • 10,778
  • 11
  • 79
  • 151
0
votes
1 answer

Write public file in controller; remote access hangs until action completes

When implementing a controller action such as the following: def create_file File.open('public/test.txt', "w+") do |f| f.write('test') end sleep(60) head :no_content end The file domain/test.txt will be accessible after the…
cwsault
  • 112
  • 5
0
votes
1 answer

Rails 4 testing controller failure

Good afternoon, I've done a scaffold of a class, here the example: User - At the moment I was executing the test I saw this bug: Minitest::Assertion: "User.count" didn't change by 1. Expected: 3 Actual:…
0
votes
1 answer

rails: string parameters ignored by active record

On a rails 4.1.4 application some parameters are not processed by the model, presumably depending on their type. When making a POST request like the following, all parameters get processed correctly and the new recipe is saved to the database with…
ehp
  • 1,689
  • 3
  • 14
  • 20
0
votes
1 answer

Trouble redirecting to a method belonging a child's table

I have two tables, one child of the other: resources :events do resources :invitations end How can i reach the path:/events/:event_id/invitations/new specifying the parameter event_id in a method inside invitations controller?
0
votes
1 answer

Nested Controller's create Action respond_to Fails To Render :new If Save Fails

I have a nested Photo controller with the following action: def create @photo = @gallery.photos.new(photo_params) if @photo.save flash[:notice] = "Created new photo" else flash[:error] = "Couldn't create photo" end …
Undistraction
  • 42,754
  • 56
  • 195
  • 331
0
votes
3 answers

No route matches {:action=>"edit", :controller=>"blogs"}

I'm doing something silly wrong here, but I can't figure what is it. In my view I have the following code: - if current_page?(edit_blog_path) That I use to show some page specific features in the page. this causes the following error:…
Don Giulio
  • 2,946
  • 3
  • 43
  • 82
0
votes
1 answer

ActionController::UnknownFormat: when using Rspec

I am creating a simple API to perform CRUD actions on contacts. :index, :show, :create and :update methods are working properly and they all pass their respective request rspec tests. The problem only arise in the :destroy method. The :destroy…
Optimus Pette
  • 3,250
  • 3
  • 29
  • 50
0
votes
3 answers

Rails: Validate params before they are handled in controller?

I'm making a rails app where user can paste a soundcloud link in an input field. Then, this link is sent to the create action in my post_controller and used to get the JSON file for that song. # app/controllers/post_controller.rb def create …
allegutta
  • 5,626
  • 10
  • 38
  • 56
0
votes
1 answer

Controller instance variable not accessible in helper

I've been messing with my ApplicationController and somehow broke something. My helper ApplicationHelper::current_settings serializes @user so that my JS app can load the current user's data. But suddenly: undefined method `id' for nil:NilClass at…
rmosolgo
  • 1,854
  • 1
  • 18
  • 23
0
votes
2 answers

Rails: passing params hash to model

I have a user-to-user messaging system. I'm trying to pass an array of user ids to a ConversationUser (join table) model which would then create multiple conversation_users from each individual user.id. The two fields in ConversationUser are…
0
votes
1 answer

Rails 4.0.2 ActionController::ParameterMissing in AuctionsController#create param not found:

I am creating an auction website and I get an error when I run a command to create a new auction. The model is simple: class Auction < ActiveRecord::Base has_many :bets has_many :profiles, :through => :bets and etc. The controller: ` class…
0
votes
1 answer

Rails sessions fails first time and passes on reload

On login, and logout I end up getting this error when trying the first time. However, after refreshing it goes through. "The change you wanted was rejected. Maybe you tried to change something you didn't have access to. If you are the application…
adanot
  • 318
  • 2
  • 21
0
votes
3 answers

How can we Override ActionController in rails to common out certain methods?

I have the authentication code to be available over several Controllers. So I thought of putting the Authentication code in to a SuperClass and then make all the other controllers extend this SuperClass. I then got to know that we can add it in the…
MohamedSanaulla
  • 6,112
  • 5
  • 28
  • 45