rubymonsters / text-to-squares

Railsgirls Berlin Learning Group Project
13 stars 14 forks source link

undefined method name for nil (user) fixed #93

Closed bioshrimp closed 12 years ago

bioshrimp commented 12 years ago

Oki, also tried the branch thingy for this. I hope I did it right.

The 2 little changes from yesterday added to index.html.erb and show.html.erb. To get rid of the error message "undefined method name fol nil:NilClass" (user), when trying to access the list or a deleted users squares picture.

svenfuchs commented 12 years ago

:+1:

tyranja commented 12 years ago

I found out, that we dont save the user in the Databank. We only saved the input in the text database. So the view in the index page doesn't find the name of the user, cause there is none.

After some confusion and some help from the outside ;) I wrote that

@text.user = current_user

in the text_controller in the create action. Now it works. Yeah!!!!

carlad commented 12 years ago

so is this one good to merge?

bioshrimp commented 12 years ago

@carladrago I can´t merge it anymore "This pull request cannot be automaticall merged." I don´t think the line I just removed has anything to do with it since I couldn´t merge before either.

I think that means that there is a conflict maybe with the recent changes you merged before me? I see you have changed the line 6 in show.html.erb to: <h4 style="color:#456789">This is <%= @text.user.name%> aka <%= @text.user.screen_name%>'s square.</h4>.

But my changes to this line are: <h4 style="color:#456789">This is <%= @text.user.name if @text.user %>'s square.</h4>

So I guess now it makes no sense anymore and I would have to change my feature so it fits your change. ?????

carlad commented 12 years ago

@bioshrimp yep lemme look at it...

carlad commented 12 years ago

try updating from svenfuchs master now

bioshrimp commented 12 years ago

Wahhh, I did but my branch is now kinda messed up. So I did it all over and made a new pull request. Closing this one.