session_store.rb
is:
YourApplicationName::Application.config.session_store :cookie_store, key: ‘_yourapplicationname_session’
should be:
YourApplicationName::Application.config.session_store :cookie_store, :key => ‘_yourapplicationname_session’
wrap_parameters.rb
is:
wrap_parameters format: [:json]
should be:
wrap_parameters :format => [:json]
ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
LX9901145:initializers m2peters$ gem list
sikachu
(Prem Sichanugrist)
March 2, 2012, 7:31pm
2
No, that is Ruby 1.9 hash syntax. It will generate that syntax if you’re using Ruby 1.9.
You’ve got to be kidding? Why do these people waste their time with such pointless syntactical changes? Does it improve performance? No. Does it improve readability? No.
Why does the comment in “wrap_parameters.rb” say the following?
Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
Same reason people waste their time writing such pointless rage filled misinformed emails to mailing lists I guess. Does it improve understanding? No. Does it improve their perceived intelligence? No.
Not sure where you got the “rage” from.
Again, not sure where you got the “rage” from.
I tend to get it from top-posting with no trimming
Just taking a long breath to answer you, this syntax change is not pointless, it’s a preparation for syntax like this:
some_method(name ‘bob’, age: 25)
in some_methods, the arguments is not a hash but they are named params…
Anyway, before this becomes a flame war again, post to rubyonrails-talk or ruby ML/IRC
Wael
So that’s what top-posting is. Why does Google Groups default to top-posting!!!
radar
(Ryan Bigg)
March 2, 2012, 9:35pm
11
This is what would be gauged as “rage” here. They’re not pointless syntax changes. They’re adapting to the shorter syntax for hashes provided by 1.9. It didn’t have to be done, but it’s just nicer to have it.
Please don’t assume that they’re pointless. Most changes in Rails actually do have a point.
Ah, that makes it all better. Don’t they have better things to work on?
(That’s a rhetorical question and not directed at you)
All these syntactic sugar changes just add to the barriers to entry.
(I don’t blame you for this)
Isn’t “name ‘bob’” the syntax for passing “bob” as an argument into the “name” method? Or has that all changed too?
If I saw “name ‘bob’”, I would think that there’s a method named “name” defined somewhere.
def name(str)
do something with str
end
Trek
(Trek)
March 2, 2012, 10:14pm
15
Isn't "name 'bob'" the syntax for passing "bob" as an argument into the "name" method? Or has that all changed too?
If I saw "name 'bob'", I would think that there's a method named "name" defined somewhere.
def name(str)
# do something with str
end
Sounds like a great question for rubyonrails-talk or ruby ML/IRC.
sikachu
(Prem Sichanugrist)
March 2, 2012, 10:14pm
16
There's a mistyped there in the code. It has to be `name:`, not `name.`
Apparently all these syntactical changes confused you too
I’m scared does “name.” mean something? For all I know it does now
sikachu
(Prem Sichanugrist)
March 2, 2012, 10:25pm
19
Oh, I put the period in the `` because the sentence ended there. Sorry if that's confused you.
The correct code is this:
some_method(name: 'bob', age: 25)
- Prem
Any programmer worth his salt disobeys the imperfection of quotation punctuation rules
Putting a period inside the quotes is like having two opening tags but only one closing tag.