Ruby on Rails Friday, October 3, 2014

Adham,

The code I posted was just to show you that Carrierwave requires that you add a suffix "remote_" and a prefix '_url' to the parameter managed by carrierwave, in order for it to work with urls.

In your case the following code is not doing that, you are passing the the parameter 'avatar' without the sufix and the prefix.

user_controller.rb

28- @user = User.new(user_params)
 
def user_params
params.require(:user).permit(:username, :name, :email, :password, :password_confirmation, :age, :gender, :avatar)
end


You gotta find a way to pass 'remote_avatar_url' => 'http:://www.test.com/someimage.jpg'

That is what carrierwave requires to work with url instead of files.

[]`s


===================
Alexandre Mondaini Calvão

"Nossa recompensa se encontra no esforço e não no resultado. Um esforço total é uma vitória completa." [Ghandi]

2014-10-03 14:04 GMT-03:00 Hassan Schroeder <hassan.schroeder@gmail.com>:
On Fri, Oct 3, 2014 at 8:54 AM, Adham El-Deeb <adham.eldeeb90@gmail.com> wrote:
> there is no html on my app it is an API and i want to save the user from the
> User Model it self

1) What client are you using?
2) What params are being logged for a create request?
3) What does the log show for a request sequence?

I have no experience with Carrierwave but are you sure that it's not
expecting a "remote_avatar_url" param by default, as Alexandre
suggested? That has nothing to do with whether you're using HTML
or not...

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAWm7QCuSLt_N5iwOqLORkWt_hRvOzbZ5rE_LwxRdg4%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BaBw4ScOCpZCqc45%2BtkYmtPQBHKGVDg%2Bs%3DTmkJswoAz-FpmTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment