Live data from Hacker News

Rails 4.2.3 and 4.1.12 have been released

weblog.rubyonrails.org

21–30 of 30 posts

Re: Rails 4.2.3 and 4.1.12 have been released

#21
post #19
post #9

Earlier quoted context omitted.

> and looks like there are better alternatives now. ...such as? It'd help to know what you consider to be "better alternatives" because it gives scope to what your priorities are. I've seen discussions in which people say, "Well now there's Sinatra"...which is fine, but that's more of an opinion about "Lightweight projects and systems are nicer" rather than "Sinatra is better than Rails". I used to use Rails all the…

Better alternatives could be one of NodeJS frameworks, Play in Scala and Dropwizard for Java. They could be better in the sense, that I can share a JS library between the API and Frontend or I can share a JVM library between the API/Infrastructure layer.

So I've been using Rails in production for a few years now, and its pretty good. I'm sure there are better options for a number of specific domains. I also use Dropwizard(because I need to use a few java only libraries) and dropwizard is in no way better than rails, except in the number of requests per second it can handle. It is a pain to set up compared to rails, the docs are terrible, it forces you to use maven and they refuse to help you with gradle. There are very few Stack Overflow answers, and thats a problem, because Dropwizard offers few sensible defaults, its configuration all the way down. And generally, the lack of livereload makes web development a pain in java.

Can't speak to Play though.

Re: Rails 4.2.3 and 4.1.12 have been released

#22
post #3

Is Rails relevant today in the world of rich front end frameworks other than for legacy applications? I used to be a big fan of Rails but there is a steep learning curve and looks like there are better alternatives now.

I've been using Rails since 1.1 or so. It was the first framework I picked up, and the learning curve was steep for me (I didn't even know what a GET was at the time). It is much more involved now. Before there was no bundler, no asset pipeline or compiled assets of any kind. Javascript was an afterthought. There were no real choices to make. Railscasts was active. This was huge. Repeating for emphasis. Railscasts wa…

I agree with this so much. Would you be willing to share some examples of how you leverage Angular with Rails? I'd really like to see something that does this that isn't a toy. I'll even sign an NDA. I just would like to learn.

Re: Rails 4.2.3 and 4.1.12 have been released

#23
post #3

Is Rails relevant today in the world of rich front end frameworks other than for legacy applications? I used to be a big fan of Rails but there is a steep learning curve and looks like there are better alternatives now.

I've been using Rails since 1.1 or so. It was the first framework I picked up, and the learning curve was steep for me (I didn't even know what a GET was at the time). It is much more involved now. Before there was no bundler, no asset pipeline or compiled assets of any kind. Javascript was an afterthought. There were no real choices to make. Railscasts was active. This was huge. Repeating for emphasis. Railscasts wa…

Good post here. I'm doing similar things with Angular and Rails. For the most part jQuery gets me most of the way. In cases where I need something really complex I just look to Angular 1.x for that one page. It works, it's easy to use(for the most part), and you actually end up writing less javascript then if you tried to do adhoc jQuery stuff.

I'm finding Turbolinks partial replacement a good option in some cases too.

The thing with not doing a traditional SPA in one Javascript framework, is you can rip out or add anything at anytime. So say in the next 30 seconds when a new Javascript framework comes out, I can use that in my Rails app. If I embraced Angular for my entire app it would be impossible to change the framework out. I've been able to play with React, Knockoutjs and others on certain parts of my app because I'm still embracing traditional navigation(with Pjax or Turbolinks)

Re: Rails 4.2.3 and 4.1.12 have been released

#24
post #13
post #3

Is Rails relevant today in the world of rich front end frameworks other than for legacy applications? I used to be a big fan of Rails but there is a steep learning curve and looks like there are better alternatives now.

Is there a steep learning curve? Admittedly, I haven't had to pick up too many new frameworks, but I would have thought Rails was easier to pick up than many others.

It's easy if you stick with vanilla Rails. Where it gets complicated is if your team decides to use a different view language, a decorator gem, a factory framework, and a different testing framework. The more deviations from Rails proper, the higher the learning curve gets.

If a person know Git, HTML, JavaScript, and one server-side language, I can teach them enough Rails to build production apps in a few weeks. I've had a lot of success with that.

Re: Rails 4.2.3 and 4.1.12 have been released

#25
post #13
post #3

Is Rails relevant today in the world of rich front end frameworks other than for legacy applications? I used to be a big fan of Rails but there is a steep learning curve and looks like there are better alternatives now.

Is there a steep learning curve? Admittedly, I haven't had to pick up too many new frameworks, but I would have thought Rails was easier to pick up than many others.

> there is a steep learning curve

citing the parent

no that's bullshit, just do the rails tutorial online and you'll be good to go. OF course you need to know Ruby. Like with any other language, you can't just learn the framework.

Re: Rails 4.2.3 and 4.1.12 have been released

#26
post #21
post #19

Earlier quoted context omitted.

Better alternatives could be one of NodeJS frameworks, Play in Scala and Dropwizard for Java. They could be better in the sense, that I can share a JS library between the API and Frontend or I can share a JVM library between the API/Infrastructure layer.

So I've been using Rails in production for a few years now, and its pretty good. I'm sure there are better options for a number of specific domains. I also use Dropwizard(because I need to use a few java only libraries) and dropwizard is in no way better than rails, except in the number of requests per second it can handle. It is a pain to set up compared to rails, the docs are terrible, it forces you to use maven an…

> Dropwizard [...] forces you to use maven and they refuse to help you with gradle

The configuration syntax (YAML) shown in https://dropwizard.github.io/dropwizard/manual/configuration... looks quite nice. It says there you can use JSON instead. The syntax Gradle uses (i.e. Groovy) has a lot of cruft, including even a full programming language, which can be misused in build config files so best steer clear.

Re: Rails 4.2.3 and 4.1.12 have been released

#27
post #19
post #9

Earlier quoted context omitted.

> and looks like there are better alternatives now. ...such as? It'd help to know what you consider to be "better alternatives" because it gives scope to what your priorities are. I've seen discussions in which people say, "Well now there's Sinatra"...which is fine, but that's more of an opinion about "Lightweight projects and systems are nicer" rather than "Sinatra is better than Rails". I used to use Rails all the…

Better alternatives could be one of NodeJS frameworks, Play in Scala and Dropwizard for Java. They could be better in the sense, that I can share a JS library between the API and Frontend or I can share a JVM library between the API/Infrastructure layer.

> I can share a JVM library between the API/Infrastructure layer.

Rails run perfectly on the JVM.

Re: Rails 4.2.3 and 4.1.12 have been released

#28
post #5
post #4

Earlier quoted context omitted.

Yes

Thank you, so Rails would be a front runner choice for you when developing a new web application?

Use the right tool for the job. If your project is just a REST api then Rails might not be the right choice. If you're writing a complex CMS/CRM,ecommerce site,or anything that has a complex UI from scratch, then rails and ruby's gigantic ecosystem will set you up and running in no time.

But so can Spring,Django or Symfony if you know them from the inside out.

Re: Rails 4.2.3 and 4.1.12 have been released

#29
post #22

Earlier quoted context omitted.

I've been using Rails since 1.1 or so. It was the first framework I picked up, and the learning curve was steep for me (I didn't even know what a GET was at the time). It is much more involved now. Before there was no bundler, no asset pipeline or compiled assets of any kind. Javascript was an afterthought. There were no real choices to make. Railscasts was active. This was huge. Repeating for emphasis. Railscasts wa…

I agree with this so much. Would you be willing to share some examples of how you leverage Angular with Rails? I'd really like to see something that does this that isn't a toy. I'll even sign an NDA. I just would like to learn.

I don't really have anything I can show you directly, but here's what I do:

I recreate the view directory structure in the assets folder, but only for views where I need a complex (angular) UI. So I might have a file in assets/javascripts/users/show.js because the users#show view is more complicated than I want to do in rails.

If that asset file exists, I have a helper automatically load it into the head section of the view layout when the users#show action is hit. The helper itself is only a few lines of some obscure rails code that looks up the name of the controller, action, etc and looks up the files in the assets directory. If you match the view directory structure to the assets directory structure, it stays very organized and is all done by convention.

In the show.js file, I will create an entire mini angular app (one file). The show.html.erb view will just contain angular markup (and maybe some erb). It's that simple. If Angular needs some instance variables from rails, I just pass them in to js with a couple lines in a tag at the beginning of the view.

If I need a custom directive, I put the templates for those in public/templates (there may be a better place for these, depending on what you're doing - for my use case, this was fine).

There are some downsides - you have to separately compile each js file. I suppose you could do them all together, but I like keeping them separate. But largely, you can lay angular on top of rails in a very unintrusive manner this way. It probably doesn't work for every situation - you have to keep your angular apps small or it gets complicated again. But it really lets you enhance the UI of a rails app without a lot of technical debt. Code reuse can be a challenge (organizing bits that are shared is kinda wonky), but often the angular apps are small and simple enough that this isn't really a problem. Repeat yourself a little. It won't kill you.

An example of where I've used it is to load a chart and some daily/weekly/monthly selectable data that is sortable by columns, by date, with pagination, search fields, etc. I make the data available via rails as JSON, and just have the angular app pull it all in for the user to manipulate.

Another would be a form that creates a query interface similar to the one used by google analytics to create custom segments.

There may be better ways to do all this, but this approach has served me well. It's a little rough, and I'm sure it could be improved. As always, YMMV.

Post reply on HN