You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
Hey,
thank you for reading this post.
Why won't this work?
outer = []
func = ->(n) { outer << n }
func[1]
=> outer stays empty. Why that? Since outer is readable in the lambda
function it should be changeable as it is the same instance of the
array. I am a bit confused.
Thanks you very much for your answers.
ms
IAmNan
unread,
Apr 20, 2012, 8:32:08 PM4/20/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
Are you doing this in the model, and is outer a member variable? If so, did you forget to use self on it?
self.outer = []
func = lambda { |n| self.outer << n }
func[1]
IAmNan
unread,
Apr 20, 2012, 8:35:51 PM4/20/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
Oh, here's with the new notation you're using. Sorry about that.
self.outer = []
func = -> n { self.outer << n }
func[1]
ms
unread,
Apr 21, 2012, 7:17:29 AM4/21/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
Thank you very much for your answer. I did not mention that I am not
using Rails in this case.
But the problem disappeared this morning - somehow. :)