Forum: Ruby on Rails has_one nil from Devise

Posted by Lucas Lima de Souza (Guest)
on 2012-08-16 13:43
(Received via mailing list)
I'm using namespace with Devise and i can't get the object ptofile in 
view
to render.

class Freelances::ProfilesController < ApplicationController

  before_filter :authenticate_freelance!

  def show
    respond_with = current_freelance.profile
  end

end

show.html.erb

<%=render @profile %>
<%=link_to 'edit', edit_freelances_profiles_path(@profile)%>
<%=link_to 'remove', :confirm => 'Voc tem certeza?', :method => :delete 
%>

error

'nil' is not an ActiveModel-compatible object that returns a valid 
partial path.

Extracted source (around line *#1*):

1: <%=render @profile %>
2: <%=link_to 'edit', edit_freelances_profiles_path(@profile)%>
3: <%=link_to 'remove', :confirm => 'Voc tem certeza?', :method => 
:delete %>


More info : https://github.com/lucaslimasouza/AutoNoMapa

Thanks
Posted by Colin Law (Guest)
on 2012-08-16 21:54
(Received via mailing list)
On 14 August 2012 14:00, Lucas Lima de Souza <lucaslima4p@gmail.com> 
wrote:
>
> 'nil' is not an ActiveModel-compatible object that returns a valid partial
> path.
>
> Extracted source (around line #1):
>
> 1: <%=render @profile %>

That means @profile is nil.

Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.