Displaying 2 results from an estimated 2 matches for "addresses_control".
2006 Jan 18
5
Inserting the parent Id to the child table
...sses table?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++
List.rhtml (students)
--------------------
<td><%= link_to("Address" , :controller => "addresses", :action =>
"list", :id => student) %>
Addresses_controller
-------------
def list
@addresses = Address.find(:all, :conditions => [ "student_id= (?)",
params[:id]], :limit => 5)
@session["student_id"] = params[:id]
End
def create
@addresses = Address.new(params[:addresses])
@addresses.student_id=@session["s...
2007 Nov 21
7
describe AddressesController, "handling GET /addresses" do
Hello,
I''m working with scaffold generated controller test code for handling GET
requests. Address is the model being tested. Address belongs_to Company,
Company has_many addresses.
In my addresses_controller I have:
before_filter :get_company
def index
@addresses = @company.addresses.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @addresses }
end
end
private
def get_company
@company = Company.find_by_id(params[:comp...