Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Wasn't rails a framework to simplify Ruby? Legit asking because I don't know.
-
devPlant87y@projektaquarius rails adds a lot of extensions directly to ruby language. Some things it adds are not even possible in javascript. Like the "try" method.
I'm dealing with this kind of code in React all the time:
```
if (user && user.profile && user.profile.subscriptions) {
```
In rails:
```
if user.try(:profile).try(:subscriptions)
```
Rails here extends nil (null) since in Ruby everything is an object, and so is nil. It returns nil if can't call a method, otherwise calls the method. In Javascript, null is a primitive, but when you do "typeof null" you get "object"! PS "typeof [ ]" is also "object"... -
Worldyn1727yMeteor is awesome! Create multi platform apps. Publish and subscribe is the best for sending exactly those models I need on client. Websockets for real time update on certain changes you control very easily. Optimized client db cache. Basically stuff you need to implement anyway. Awesome community.
-
gratzl2617y@devPlant hey, try() looks pretty useful actually. Why isnt this in vanillajs? It's literally one line of code.
-
devPlant87y@gratzl because one guy wrote vanilla js in about a week (which is a statue worthy thing, but a wrong foundation for any serious programming language), and ruby is made for developer's pleasure. Ruby is so powerful that you can create your own language with it. In fact many gems do exactly that - create their own DSL (Domain Specific Language)
I hate javascript and all the shitty frameworks it has.
Background: I'm coming from Ruby on Rails world. Ruby is a nice short language built primarily for developer's happiness.
I recently started working on a meteor.js project. Oh boy that framework is terrible. Do I even have to start from all the dependencies failing to install because npm is shit, installs everything locally and only recently discovered lock files?
Fetching a post and its author from the database looks like a fucking space rocket compared to Rails' ActiveRecord fetching.
Meteor.js fetching:
```
Meteor.publishComposite('posts.all', {
find() {
return Posts.find(); },
children: [{
find(post) {
return Users.find({ _id: post.authorId });
}
}]
});
```
Rails ActiveRecord fetching:
```
Post.includes(:authors)
```
Sure, you might get more benefits like meteor uses websockets and it's all a single language, but that piece of the code above that I have to deal with all the time now...it gives me cancer.
undefined