Displaying 20 results from an estimated 4000 matches similar to: "Can't get to an action in a RESTful controller"
2011 May 06
3
Rails 3 Routing problems
I have an UploadsController and UsersController where Users''
has_many :uploads'' via polymorphic attachment in uploads.rb.
Now we i navigate to http://localhost:3000/users/1/uploads
I get re-routed to Uploads#index and rendered is called multiple times
as shown below:
Started GET "/users/1/uploads" for 127.0.0.1 at 2011-05-06 22:00:38
+0100
Processing by
2009 Sep 30
1
2 RESTful controllers for the same resource
Hi everyone I want to have two restful controllers for the same
resource (Users)
One controller (UsersController) is straight in the controllers folder
and is used for singup and so on
Then i need another controller for users which is inside an admin
folder (Admin::UsersController)
In my routes.rb i have
map.resources :users
# Sample resource route within a namespace:
map.namespace
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
When I''m executing cucumber tests, I noticed that sometimes rails app
(in test env.) getting several the same requests (GET or POST) usually
around 3, and it doesn''t render anything with empty HTTP status code.
Have anyone met something similar to that issue?
here is some example of log file:
Started POST "/account" for 127.0.0.1 at 2010-11-30 22:34:17 +0200
2007 Feb 10
3
recognize_path discrepency
hey all - wondering if someone would relive my confusion...
given a model called say Meeting and a route as
"map.resources :meetings"
in the console:
>>r=ActionController::Routing::Routes
>>r.recognize_paths "/meetings"
=>{:action="index",:controller=>"meetings"}
all works as I expect, but if I do
>>r.recognize_paths
2008 Feb 24
3
params checking in controller before real action
I want to perform certain action in controller based on request
parameters. Is there some way to access params in controller before a
real action? Like in following code:
class UsersController < ApplicationController
# params[:type] in here does not work
ssl_required :create if params[:type]=="something"
def create
# params[:type] works in here.
end
end
If not,
2010 Sep 22
20
problem in downloading large file with apache+mongrel
hii all,
am using apache as frontend to mongrel and loaded xsendfile
module in apache ,am looking for 1 GB of download .this is download
routine
def download
@stream = Stream.find(params[:id])
send_file(@stream.location,:filename => @stream.name,:disposition >
''attachment'',:x_sendfile => true )
and
And this is how it is processed
Processing
2011 Jun 22
3
Status of Rails.application.routes.recognize_path()
Sorry if this question isn''t really "Ruby on Rails: Core" material. I feel
it is, at least kind-of (also, I first tried asking in "Ruby on Rails: Talk"
to no avail.).
So, while writing a gem (engine) for rails, I found that I needed to have my
app (in a pre-filter) directly query the router. In the "old" days, this was
done using
2009 Apr 27
5
ruby jasper report
Hi,
I am trying to create a pdf using ruby jasper.
For this I am referring this url:-
http://oldwiki.rubyonrails.org/rails/pages/howtointegratejasperreports
I have done everything whatever is in that link.
Still I am not able to get the pdf. I am not getting any error in log
file. My log file is:-
"Processing AccountController#customer_report (for 127.0.0.1 at
2009-04-27 13:19:34) [GET]
2011 May 17
6
Nested Resource w/ Collection
Hi guys,
In my routes file I have the following nested resource:
resources :users do
collection do
get ''posts''
end
end
However, when I visit this URL: http://localhost:3000/users/posts, I get this error: "The action ''posts'' could not be found for UsersController"
In my UsersController I have the following:
class
2009 Sep 29
0
Problem with RESTful resource and ActiveScaffold
Hello everyone,
I am trying to use a RESTful controller for user inside a namespace
using AS and one outside for registration and so on. When i try to
visit the namespaced url I get Unknown action. Once i replace
active_scaffold :users with a def index; end i can the URL.
My routes look like:
map.register "register", :controller => "users", :action =>
"create"
2009 Mar 06
2
Routes.recognize_path on more complicated Routes
For a permissions system i''m writing i''m extending the standard link_to
helpers to check if a user has a permission to perform that action
before displaying a link to clean-up my code so i don''t have to put if
checks all over them.
I''m trying to use..
ActionController::Routing::Routes.recognize_path(url, :method => method)
to get the action and controller
2008 Jun 04
5
controller filters running twice in 1.1.4?
since upgrading to 1.1.4 (I had been running without issue on a git
snapshot), I''m noticing that my filter actions initiated from application.rb
seem to be running twice. I created a test rails project with the rspec
scaffold and am also seeing the same behavior here too.
Adding this code to application.rb:
before_filter :foo
def foo
"foo"
end
and an example
2009 Jan 16
16
Testing arbitrary post action parameters
I am working on our (newly renamed) authentication feature. The current
scenario is:
Scenario: Non-administrators should not set administrator ability
Given I have no users
And I add a user named "admin" as an administrator
And I add a user named "myuser" as not an administrator
When the user named "myuser" authenticates
And the user
2010 Oct 28
4
how do i find the trigger of an 'unknown' action
hi , in my logs i see that:
Completed in 1480ms (View: 267, DB: 90) | 200 OK [http://192.168.2.9/xyz/99]
SQL (1.4ms) SET NAMES ''utf8''
SQL (0.7ms) SET SQL_AUTO_IS_NULL=0
Processing xyzsController#images to gif (for 192.168.2.3 at 2010-10-28
15:22:35) [GET]
Parameters: {"id"=>"loading"}
ActionController::UnknownAction (No action responded to
2009 Nov 11
6
HeLp oN my database
Using my application i can able to save a new record into my db
but i cannot update a existing record into my db.
using update query i can able to update my records.
but using update_attributes it doesnot update my records.
even i cant find any errors in logs or something.
throughout my application i can able to save a new record but unable to
update my existing records.
actually i have changed
2007 Sep 16
2
Problem with recognize_path
Hello,
I am experiencing a weird problem on one of the 3 test servers I''m
using:
There is a controller named admin/statistics and I am trying to
access /admin/statistics
The matching rule is: map.connect '':controller/:action/:id''
On 2 of the 3 servers, recognize_path correctly matches to
Parameters: {"action"=>"index",
2007 Aug 25
4
REST routes :has_many , new style
I am trying to write a nested route ''new style''
map.resources :franchises, :has_many => :documents
in place of the :
map.resources :franchises do |franchises|
franchises.resources :documents, :name_prefix => "franchise_"
end
but get an error :
no route found to match "/franchises/1/documents" with {:method=>:get}
running rake routes,
2010 Feb 25
9
uninitialized constant UsersController::User
i just created an application to list the primary details of
userbut it is showing an error lik this
"uninitialized constant UsersController::User"
this is my controlller
class UsersController < ApplicationController
puts"hiiiiiiiii"
def index
puts"hiiiiiiiii"
@users = User.find(:all)
puts @users
respond_to do |format|
format.html # index.html.erb
2008 Oct 20
5
RSpec-Rails bug with to_xml?
Hello, everyone. I''ve been lurking here for a while, but this is my first post.
I think I''ve run into a RSpec bug in a Rails project I''m working on. I
was working on a few REST controllers, and started getting failures on
a specific spec that verified whether a certain action returned XML
output. I spent quite a lot of time checking my code to see if it was
something I
2007 Nov 14
6
My own methods on model + "extends" problem?
Hello.
I have a UsersController and a Model called User with a "new" method,
like this:
class User < ActiveRecord::Base
def test
return 1 #I can do anything and return any data, the
problem continues.
end
end
The problem is that I cannot access my "test" function from the
controller. It says that the method doesn''t exists.
class