@dpsk you can get the same thing in rails 3 using postgres_ext
gem. The main point of this protip is how to make uuid column
- primary key
- autogenerated
@matthewwithanm you're absolutely right, in this particular example a much simple code like that could work:
success: function(a1, a2, a3){ return myObj.myMethod(a1, a2, a3); }
but I wanted to make an example with kinda more unified and general way of doing binding where you're not concerned by the number of arguments.
@koehr no, => preserve the current context, which is unimportant.
@matthewwithanm apply is the only was to pass all arguments directly to a function. If you know an easier way to do the same thing, please tell (there is none actually).
why not just
render partial: 'json_partial', formats: [:json], locals: { foo: @bar }
?
oh, i didn"t knew you could do that. i was doing the same thing in a slightly more verbose way:
git fetch
git rebase origin/my-branch
great advise, thanks
Macports in 2012? Really? And I thought everyone switched to homebrew back in 2011.
I wonder why they chose such complex way to do class attributes. I've always used instance variables for that:
class Base
class << self
attr_accessor :settings
end
end
class Subclass < Base
end
Subclass.settings # nil
Subclass.settings = 'bar'
Subclass.settings # 'bar'
Base.settings # nil
Base.settings = 'foo'
Base.settings # 'foo'
Subclass.settings # still 'bar'
UPDATE: Checked the docs and figured the difference. The class_attribute is inheritable, instance variable is not. Thanks for the protip, it made me investigate this stuff deeper. :)
@emadb, oh, so stupid of me to forget to include link. Fixed :)
Thanks for rbenv-rehash. Never knew there is such gem.
Nice catch.
Anyway, what's the point of using try
with dynamic method like this?
Could be shortened to:
request = (type) -> (url, data) -> $.ajax { type, url, data }
get = request 'GET'
response = get 'http://www.google.com', q: 'coffeescript'
Achievements
748 Karma
47,082 Total ProTip Views
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/altrustic-fea3bde05a17a18ff6420dbd7a646cc4536c51f46db27536401e56bee0dc086a.png)
Altruist
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/100lemming-75ef69b417fed814e00911c952268ec8f46e670b2b7f1d3197e95e531530c5f3.png)
Lemmings 100
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/moongoose-rails-61a44b75d25bd09e63c2780a21585332438ff57f0e9e00b022f625170133ef69.png)
Ashcat
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/cub-d811dfda174e9ca232964477c16369e9ed8caf4a47d746348a358f3579b8ffdc.png)
Cub
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/walrus-1f517cbbd8f030099b8386c53d4ee40fece3fa146b6362accb3abddb436482cb.png)
Walrus
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/forked1-63f23ad054823f6065b4526f8552dbc2c4fbaa75d22db7150d700201218ac426.png)
Forked
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/coffee-8704f08f6046466a103a67e28414732e8327b35a4ba700cfb896bb1b67dff554.png)
Kona
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/mongoose3-3c4898df9b91ea4bec8bce0c83908998df630cbbf749d2dcfadba121af2bf1fa.png)
Mongoose 3
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/charity-bab6d575c53894cc9e395db7cdb1f0f91f176fa0cc8122c5f824e672f3d556a4.png)
Charity
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/mongoose-299fb33af2a4e416505b484d73e79ee3ff1840f3c7385d6bbbc158f76be054cb.png)
You can run the it directly with
$ rspec spec/any_spec.rb:10
where 10 is the line number of the spec you want to run.