Displaying 5 results from an estimated 5 matches for "addressescontroller".
2007 Nov 21
7
describe AddressesController, "handling GET /addresses" do
...sses).and_return(@addresses)
Company.stub!(:find).and_return(@company)
end
def do_get
get :index, :company_id => 1
end
it "should be successful" do
do_get
response.should be_success
end
.............
All of my tests (4) fail:
4) NoMethodError in ''AddressesController handling GET /addresses should be
successful''
You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.addresses
Please, can someone explain why i''m getting nil.addresses?
Cheers!
Omar
-------------- next part --------------
An HTML atta...
2006 Feb 03
6
Saving a User Object while in the Address Controller
Hi,
My saves are failing me and I can''t figure out why.
I am trying to save an address id to a user object just after I create
the address.
This isn''t the exact code, but it shows what I am trying to do.
class AddressesController < ApplicationController
def create
@address = Address.new(params[:address])
saved_address = @address.save
@user = User.find(params[:id])
@user.address_id = @address.id
saved_user = @user.save
end
end
User.save keeps on returning false.
Any ideas...
2006 Jan 08
4
Rails table pluralizing Issue
Hi,
I am working on a table with name "addresses". However when I do a
ruby script/generate scaffold Address, I am not able to access
http://localhost:3000/addresses. I am getting the following error.
uninitialized constant Addres
This error occured while loading the following files:
addres.rb
How do I resolve this issue.
Thanks
Silvy MAthews
2007 Oct 26
1
Custom method in Application Controller
..._data" method to
preferentially select the model so that I may use this method in other
models that have nothing to do with the City or State models and I had
hoped it would look something like this:
def load_data(model)
@model.pluralize = Model.find(:all)
end
and I call the method like so:
AddressesController<<ApplicationController
def new
load_data(:City)
load_data(:State)
@address = Address.new
end
but I get a localjumperror exception thrown in the "new" method in the
Address controller with the error message "no block given"
does any one have any idea on how to rewrite th...
2010 Sep 10
10
current_page? inside controller
...sing something like current_page? method
from ActionView::Helpers::UrlHelper inside controller ?
I have routing like:
resources :addresses
resources :mailing_addresses, :controller => ''addresses''
And I would like to do a check in my controller that would look like
this:
class AddressesController
def index
if current_page?(live_addresses_path)
# ... logic goes here
elsif current_page?(addresses_path)
# ... logic goes here
end
end
end
What''s the easiest way of achieving it ?
Robert Pankowecki
--
You received this message because you are subscribed...