Ruby on Rails
Sunday, December 27, 2015
On Sunday, December 27, 2015 at 4:15:57 PM UTC-5, Colin Law wrote:
On 27 December 2015 at 21:07, fugee ohu <fuge...@gmail.com> wrote:
> yikes, i dunno how @user got instantiated, i forgot to say i'm in a view, i
> dunno if i'm allowed to do this in a view or not: <% if
> Profile.find_by_user_id(current_user.id ) %>
You can do anything you like in a view, but what is wrong with
<% if current_user.profile.nil? %>
How many times do I have to ask you not to top post?
Colin
>
> On Sunday, December 27, 2015 at 3:51:45 PM UTC-5, Colin Law wrote:
>>
>> On 27 December 2015 at 20:04, fugee ohu <fuge...@gmail.com> wrote:
>> > in my layout i wanna test if the user has a profile so when he clicks
>> > profile my app know whether to present him with a show + link to edit
>> > the
>> > exisiting profile, or just a form for new profile ~ thanks
>>
>> How do you access the user's profile? If it is @user.profile (or
>> something similar) then @user.profile.nil? should do it.
>>
>> Colin
>>
>> >
>> > --
>> > 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-ta...@googlegroups.com .
>> > To post to this group, send email to rubyonra...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/rubyonrails-talk/ .0a78ce5d-1e7c-4f26-8c63- f9691689e191%40googlegroups. 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-ta...@googlegroups.com .
> To post to this group, send email to rubyonra...@googlegroups.com .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/ .a9e1d87d-c329-427a-bb50- ae2fe2ae8d70%40googlegroups. com
>
> For more options, visit https://groups.google.com/d/optout .
Sorry Colin, It's the goolge default When you click reply the cursor flashes on a blank line with quoting below, that's why i always forget but I'll try to remember from now on Do I have to test for nil like that I'd rather use find or find_by more absolutely ~ thanks (merry christmas)
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/72ab4192-6c0d-419e-8efc-22392ef797f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment