Displaying 3 results from an estimated 3 matches for "build_photo".
2008 Jan 24
1
Uploading files: wrong number of arguments (1 for 0)
...1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_one_association.rb:18:in
`build''
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations.rb:1114:in
`send''
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations.rb:1114:in
`build_photo''
app/controllers/accounts_controller.rb:8:in `create''--------
Here is the controller code that is causing the error:
def create
@account = Account.new(params[:account])
@account.build_photo(params[:photo]) unless
params[:photo]["filename"].blank?
@user = @...
2007 Dec 13
4
Attachment_fu problems on updates
...out selecting a new picture, the users picture
is lost (the db row values are set to nil)
Here is the controller code for the update:
--------------------------------
def update
@member = Member.find(params[:id])
#try to not set the photo if a new one is not uploaded
@photo = @member.build_photo(params[:photo]) unless
params[:photo].nil?
respond_to do |format|
if @member.update_attributes(params[:member])
....
end
end
Here is the Member model code:
-------------------------
class Member < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :ci...
2007 Dec 14
5
How do I mock params?
Here is the code within the controller:
Line 69: @photo = @member.build_photo(params[:photo]) unless
params[:photo][:uploaded_data].blank?
I got a little ahead of myself and wrote the code, and now have a bunch
of errors telling me that:
-------
6)
NoMethodError in ''Spec::Rails::Example::ControllerExampleGroup
MembersController handling PUT /members/1 should find t...