Displaying 20 results from an estimated 1200 matches similar to: "2 RESTful controllers for the same resource"
2009 May 01
4
Can't get to an action in a RESTful controller
Folks,
I am using the restful_authentication plugin. This creates the users
controller which is declared as a resource in routes.rb as below
map.resources :users
Now in the UsersController I have created an action to resetpwd that I
am trying to get to from the login page when the user clicks "forgot
password". However, when I do that the log file tells me that the call
to
2012 Oct 23
0
route problem
Hello
I have this routes.rb
Tamara::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
resources :users
resources :category do
resources :berichten
end
end
So I thought that localhost:3000/<category>/bericht/new I could write a new
bericht which is stored in the <categoryname>
But when I look at rake routes
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
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"
2006 Feb 03
6
Go back to previous action
Hello all!
I have two views (list_1 and list_2) that show a list of users in two
different ways. In the views for these actions there is a link to edit a
specific user properties (edit_user). That works fine, except that when
I change the user I want to go back to the view that originated the
request and not to the default list (list_1).
Can anyone help me?
Best regards,
Hugo
--
Posted via
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
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
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
2011 Jun 12
3
Problem with undefined variable current_user
Hi everyone,
I''m working through the tutorial at the following link and attempting to
customise/adapt the lessons for my own slightly different application.
Link:
Ruby on Rails Tutorial: Learn Rails by Example | Ruby on Rails 3
Tutorial book and screencasts | by Michael Hartl
<http://ruby.railstutorial.org/ruby-on-rails-tutorial-book>
I''m currently trying to work
2007 Dec 04
10
Unexpected message on :attr_accessor
This may be a dumb noob issue, but I haven''t found any answers while seaching
the forum--
I have a controller method
def edit
@user = User.find params[:id]
@user.password_confirmation = @user.password
end
The User class has an "attr_accessor :password_confirmation" definition (so
"password_confirmation" doesn''t exist in the users table). My spec
2007 Nov 18
9
Not sure why this is failing
I am not sure why the tests don''t see the call of the new method for the
Address class. It can be seen in the controller method where the
Address.new is called.
>> @address = Address.new(params[:address])
What am I doing wrong?
Thanks for the help.
Here is the error message:
Spec::Mocks::MockExpectationError in ''UsersController handling POST
/users should create a new
2008 Jan 23
2
integrate_views is not executing my views
I wanted to use "integrate_views" as Ryan explains in his RailsCast #71
(http://railscasts.com/episodes/71)
...but I can''t get it to work: the view code in not executed
I looked everywhere but I can''t understand what I am doing wrong.
Here is what I did:
I created a new application from scratch (Rails 2.0.2), added rspec and
rspec_on_rails plugins, and run
2010 Sep 19
4
Rails 2.3.8 - InvalidAuthenticityToken problem. URGENT!
I used to have Simple Captcha installed, but since I removed it I got
all kinds of problems with login.
Processing UsersController#login (for 188.177.122.179 at 2010-09-19
12:21:09) [POST]
Parameters: {"commit"=>"OK", "authenticity_token"=>"/
Y0aZETCsMhyI3CkrZJK6O2NaLEoi+LRe8ZuDPWU9kc=",
2007 Jul 24
6
Mocking Access Control
I''m trying to jump on the TDD/BDD bandwagon, but am having trouble
understanding how i should mock my user. The user has a habtm
relationship to a roles model (acl_system2 plugin), but I''m not sure
how to tell rspec about a model.
My code:
describe UsersController do
integrate_views
before(:each) do
@user = mock_model(User)
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,
2006 May 12
5
Implementing URLs with more than 3 levels in Rails.
Hi There
I started using Rails recently, and I see it''s very easy for URLs that
have up to 3 levels:
/:controller/:action/:id
But what do you do when you need more than 3?
For example, my current project should have an "admin" interface.
Admin has several sub-interfaces, for example a "users" interface. And
the admin/users interface has several actions, e.g.
2008 Apr 03
1
Anyone experienced RSpec/Autotest forgetting models?
Hi
Saving a controller spec frequently gives me this error:
52)
LoadError in ''UsersController GET /users with basic request params should
find all the user types''
Expected /home/amoran/Documents/becta/apps/Backend/app/models/user_type.rb
to define UserType
./spec/controllers/users_controller_spec.rb:299:
script/spec:4:
I have to Ctrl-C autotest before it will load again.