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 getting single values from request

in Rails the create method in a Controller by default receives an HTTP request with different values. By default new records are created like this: @apo = Apo.new(params[:apo]) But how can i access single Values from this params hash? I would like…
Tobi89
  • 199
  • 2
  • 4
  • 11
0
votes
1 answer

How can I programatically determine which methods have been declared as "helper" methods by a controller in Rails?

I'm writing a plugin that adds a method to controllers and declares it as a helper method. If it were done statically (rather than through the plugin), it would look something like this: # in…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
0
votes
1 answer

Missing template action error in rails3

I have defined a method in controller that is like: def self.dailymail .... #fill data from db ac = ActionController::Base.new() kit = PDFKit.new(ac.render_to_string(:action => "formatinhtml.html.erb",:rawdata => data)) pdf = kit.to_pdf …
0
votes
2 answers

Extending a controller in Rails

I have a controller which calls out to another class. class BlahController < ActionController def index OtherClass.get_stuff end end In this class I want to be able to write controller style code. for instance: class OtherClass def…
Neil Middleton
  • 22,105
  • 18
  • 80
  • 134
0
votes
1 answer

ActionController caching not working in dev and test environments

I have this controller: class PagesController < ApplicationController caches_page :index def index end end and action_controller.perform_caching enabled for each in environment. On production everything acts as expected, with the cached page…
Andy Waite
  • 10,785
  • 4
  • 33
  • 47
0
votes
1 answer

RoutingError in Rails application on dreamhost

I want to test sample rails application on shared Dreamhost account, so i have created sample application with ruby 1.8.7, rails 3.2.8 and mysql database. on localhost it works fine, but after uploading it on Dreamhost its giving error when i clicks…
ajin
  • 173
  • 1
  • 5
0
votes
2 answers

How to change object attribute in update action?

I need to use method, which is working only in controller, but I can't implement changing attribute. Here is my update action: def update @website = Website.find(params[:id]) respond_to do |format| if @website.update_attributes(params[:website]) …
MID
  • 1,815
  • 4
  • 29
  • 40
0
votes
0 answers

Constantly get 406 Not acceptable error when receiving json response

I have worked with jQuery remote function in the past, but in this case I'm having trouble. I have a working remote function to check email uniqueness, but now I want to check user password, when he enters it using the jQuery validation plugin (if…
MID
  • 1,815
  • 4
  • 29
  • 40
0
votes
1 answer

Getting attributes in nested model rails 3.2

I have two models user and profile. I want to save the username and password in user and other user profile details in profile. Now, The user model has: has_one :profile accepts_nested_attributes_for :profile attr_accessible :email,…
Chirag Rupani
  • 1,675
  • 1
  • 17
  • 37
0
votes
1 answer

Can't implement before_save filter (when checking data that doesn't go to db)

I need to verify User data before_save. I'm saving only paypal_email, and don't save first and last name. I added before_save filter in my model: attr_accessible :paypal_email, :first_name, :last_name attr_accessor :first_name attr_accessor…
MID
  • 1,815
  • 4
  • 29
  • 40
0
votes
2 answers

How use data related to object which I'm not saving to database?

I need to use User data, which he is entering in form, but not save it. I added attribute accessors into my User model: attr_accessible :paypal_email, :first_name, :last_name attr_accessor :first_name attr_accessor :last_name but how can I…
MID
  • 1,815
  • 4
  • 29
  • 40
0
votes
1 answer

Strange error: after create user alway redirects ot show?

It is strange. I'm writing custom user registration and want to make redirection to OTHER page after user creation, but it want to call show action. Here is my controller: def create @user = User.new(params[:user]) respond_to do |format| if…
MID
  • 1,815
  • 4
  • 29
  • 40
0
votes
1 answer

rails action_controller usage

I digg into some project with long development history Maybe it's newbe question: For specific controller I found thats it inherited from ActionController like so class GraphController < ActionController end and seems it used for API cause when I…
Volodymyr
  • 1,136
  • 3
  • 11
  • 28
0
votes
1 answer

Getting method names from ActionController extension

I have an extension to ActiveRecord's class ActionController: module MyExtension def my_method "default implementation" end end ActionController::Base.class_eval { include MyExtension } All my controllers inherit from ApplicationController,…
aktivb
  • 1,952
  • 2
  • 15
  • 16
0
votes
1 answer

Nested model in Rails3

I have two models user and profile. I want to save the username and password in user and other user profile details in profile. Now, The user model has: has_one :profile accepts_nested_attributes_for :profile attr_accessible :email, :password The…