I am new to the world of Ruby and Ruby on Rails. I read a few tutorials, but I have some problems with the following syntax. I think that using syntax is :conditionused in Ruby to define a class attribute with some kind of accessory, for example:
class Sample
attr_accessor :condition
end
which implicitly declares getter and setter for the condition property. While I was looking at the Rails code example, I found the following examples that I do not quite understand.
For instance:
@post = Post.find(params[:id])
Why does it access the attribute idwith this syntax, and not:
@post = Post.find(params[id])
Or, for example:
@posts = Post.find(:all)
Is there a :allconstant here ? If not, what does this code mean? If so, why is the following not used:
@posts = Post.find(ALL)
thank
Mark source
share