From: Thiago Massa on
[Note: parts of this message were removed to make it a legal post.]

Couldn't find Contact without an ID



2010/7/4 Kenneth <ken70r(a)gmail.com>

> can you provide the error message???
>
> also you can dry your code a little bit...
>
> if params[:commit] == "upload and import contact"
> if params[:import_file].nil?
> flash[:notice] = 'No file was attached.'
> p user_contacts_path(@current_user)
> p @current_user.contacts
> else
> parse_vcard_file(params[:import_file], params[:user_id])
> flash[:notice] = 'Contact was successfully created from VCard
> file.'
> end
> redirect_to(user_contacts_path(@current_user))
> else
>
> end
> --
> Posted via http://www.ruby-forum.com/.
>
>


--
Thiago Fernandes Massa
11 83979414

From: Thiago Massa on
[Note: parts of this message were removed to make it a legal post.]

by looking at ur code its probably because(i'm no rails expert or
whatsoever):

@current_user is something that do have an id(i think, i don't have the
whole code).

redirect_to(user_contacts_path(@current_user.id))

or

redirect_to(user_contacts_path(:id=>@current_user.id))

also, that's ruby ON RAILS, not ruby.

2010/7/4 Thiago Massa <thiagown(a)gmail.com>

> Couldn't find Contact without an ID
>
>
>
> 2010/7/4 Kenneth <ken70r(a)gmail.com>
>
> > can you provide the error message???
> >
> > also you can dry your code a little bit...
> >
> > if params[:commit] == "upload and import contact"
> > if params[:import_file].nil?
> > flash[:notice] = 'No file was attached.'
> > p user_contacts_path(@current_user)
> > p @current_user.contacts
> > else
> > parse_vcard_file(params[:import_file], params[:user_id])
> > flash[:notice] = 'Contact was successfully created from VCard
> > file.'
> > end
> > redirect_to(user_contacts_path(@current_user))
> > else
> >
> > end
> > --
> > Posted via http://www.ruby-forum.com/.
> >
> >
>
>
> --
> Thiago Fernandes Massa
> 11 83979414
>



--
Thiago Fernandes Massa
11 83979414

 | 
Pages: 1
Prev: strange xpath output
Next: Charset Detection