What's the best Rails 4 ajax Push engine? [closed] - ruby-on-rails

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm busy with the creation of a collaborative application, where 2 users may edit the same data at the same time, without doing a full refresh of the HTML page (it is a huge table, as an excel sheet).
What is the best option in Rails 4 I have to push the modification from a user A to a user B ?
The ultimate goal should be to get an auto-update table like the one in google spreadsheet ! :-)
I didn't find a recent (>2012) answer to this question... Is there a gem or a plugin that starts an automatic process on the server side ? How the manage the user subscriptions to udpates ?

You should definitely use the websocket-rails gem, I am personnaly using it for a debate website which I'm creating from scratch.
It is using, as the name refers, Websockets. This technology is being more and more used, and is now compatible with most of the browsers, it has indeed an excellent compatibility.
websocket-rails has a lot of documentation, I also had some trouble using it for advanced usage, and got my happiness contacting their devs directly on their irc channel, they are very nice.
For your need, I think that Websockets are much more convenient than Ajax, for for your need, Ajax needs to ask the server each x second if there's something new to refresh. That will exhaust your server, but when using Websockets, the server will send you directly the new data that you need. You can find more info for this choice on this SO answer.
It handles private channels, if the data exchanged need not to be public as well, websocket-rails is definitely the way to go !
You can find it's repository here.

I will try to answer your question as simple as I can:
End of last year I created a web app that needed too many interactions and live updating on the client side.
Basically like the Facebook Wall with notification and live updates.
I achieved this through using Private_Pub which is a Gem created based on Faye, by Ryan Bates, the author of RailstCasts
There are tutorials and examples of using this for live updates.
However I don't advice you to use this, because you will end up doing so much dirty hacks and patches just to make sure the service is running and make sure connections are not closed and such.
My advice would be using a front-end JS on top of Rails Stack.
You can using Angular,Ember, Backbone and Meteor, all of them help you achieve that functionality on a safer side of things.
Check out the RailsCasts for those Frameworks from Ryan Bates:
http://railscasts.com/episodes/408-ember-part-1
http://railscasts.com/episodes/351-a-look-at-meteor
http://railscasts.com/episodes/405-angularjs
http://railscasts.com/episodes/323-backbone-on-rails-part-1

Related

How to document AngularJS + Ruby on Rails app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm using yard to generate my documentation for Rails apps from an rdoc file. There are AngularJS documentation generators, but how could they be connected to generate one coherent document for an AngularJS + Rails app?
In this case it is probably fine to have them separated, and indeed may make more sense to have them separated. Angular is going to be solely for your client-side stuff, and I'm assuming you're then using Rails as an API or perhaps a different piece of the app's functionality. Either way, they are fundamentally doing different things, so it would make sense to have them in different doc sections.
You could create a "landing page" for your documentation if you'd like: one button links to Angular docs and one to Rails docs, and that would solve the need to have them both "in one place". Actually figuring out a way to make them overlap in the same system is likely not worth the effort though, and may actually be a worse user experience.
As the previous answer stated, it would be good to use two different tools and link them together.
I would start with something like Apipie or just rdoc to document the ruby stuff. Additionally I would search for a good js documentation generator. This article compares a four different generators, while 'Docco' seems to have a ruby port with that is called 'Rocco', that may be even able to generate documentations for both, ruby and js. JSDoc on the other hand enables you to integrate custom pages into your docs (here you could place a link to the apipie generator).
In general I would probably just go for the rails API doc and have some conventions for commenting your angular code, as the angular stuff probably has no API that is accessible by another part of your system and therefore only needs some internal documentation.

Is Ruby on Rails good choice for my next web-app? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
When I am writing this, I must admit that I am already inclined towards RoR.
I have gone through official "Getting Started" tutorial and created a sample RoR app.
I have also had glance through guides.
While creating sample app, I loved the ways Rails auto-generate a whole lot of code for me, and creates a nicely organized directory structure.
Creating simple sample app is fine but now I have following questions before choosing RoR for enterprise web app.
Following are question in my mind.
How would I debug my app? While working on Java + Spring, we could step through in Eclipse, read about ruby-debug which is like command prompt debugging. Aren't there any IDE debuggers?
How would I combine all javascripts etc? in Java=Spring framework I had earlier used Google closure template for minification and joining all javascript files. would it allow sourcemap support?
Image Spiriting ? Any quick link to just look through if its possible or not?
Authentication and security : I am sure it must be possible in Rails to get logged in user's profile and then check what are db objects we can view and update, it will specific to one's web-app. Can anyone give some links, to just look through if its possible or not? can we protect the URL based on roles as we can do in spring? How do we integrate FB/Google login
Templating : While creating sample app, realized that Rails supports templating in html through embedded ruby tags, thats cool but having seen it work two more questions.
5.1 : :construct like :confirm etc would depend on jquery_ujs.js, thats perhaps
shipped with rails, but I may not want to 'jquery_ujs.js' I may have my own
different styling for modal dialogs. How do i replace jquery_ujs.js and plugin
something else ?
5.2 : app->view->layouts->application.erb.html , allows you to setup up title of all
pages and what goes in header of all pages.
But I may not want the same title and header for all pages of my web-app,
It would be different for each page. How do we do that in rails?
DB : most probably I am going to use DynamoDB as and use memcache for caching,
Any simple and sample code for pluging in the memcache in rails for dynamo
Maintaining three environment: How to we maintain three different environment in Rails, Production, staging and dev
Would i be able to use less instead of css?
As everything, there are more than one way to approach to every single question.
I usually use pry-remote to debug my rails application, because I use pow server and I use Sublime Text, but RubyMine is a nice IDE for developing Rails apps and it has a build in debugger.
Sprockets takes care of this and it's integrated in Rails. I use SASS and CoffeeScript, and you can generate source maps easily for them using those gems - sass, coffee
You can use Compass to generate image sprites pretty easily. (Check out this episode on Railscasts - Compass & CSS Sprites
Devise gem is really popular solution for authentication and for the Facebook/Google+ you can use OmniAuth which integrates nicely with Devise. And for authorisation, a really popular solution is Pundit gem.
You are free to use whatever JS UI library you like and for the dynamic layout content you can use content_for helper. You just have to add yield :page_title in your layout and then, call the content_for :page_title { 'Specific title' } in your views.
For this question, I don't have an answer but I am pretty sure that there is a gem that can help you with this like Dynamoid for example
Rails supports different environments out of the box (testing, development, production) and you can easily add your own ones.
Rails has a support for SASS out of the box, but you can easily switch to LESS. Check out less-rails gem.
Rails is pretty mature framework and the community around it is pretty good, so you can easily find a gem that can help you solve specific problem. And there are quite a lot resources around the internet.
Good luck :)
i will give a short glance
ANSWER-1
There is no such debugger like eclipse for ROR, you can use sublime_text editor for editing, Rspec is nice tool for RoR.
Answer-2
In RoR there is no need to combine all js files,you can write any of the .js file it will be render to application.js default
Answer-3
Link to question
Answer-4
There are gems in RoR which wil easily help you to do stuffs like authentication, omniauth etc..
RUBYGEMS
Answer-5
There are many ways you can easily find out asking on stackoverflow for your problem.
Suggession:
Instead of asking many question you should try to learn ruby deeply you will easily get your answers.

Is there anything in Node.js like scaffold in Rails? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there any tool or framework in Node.js that allows you to create a table in the DB and generate RESTful APIs automatically like Rails?
Thanks a lot!
I guess it depends on what you want:
Rails style code generation (where it generates code for you that you can modify)
Django style semi magic where admin forms can be derived from the fields in your table/document schema.
you mean generating an API for these fields in the database, ala what grape does for Ruby -- you do some configuration and translating data to JSON and transmitting it back over the wire is taken care of for you
You have a new project and you're looking for a framework with one of these three characteristics
For the first three options there are a few related SO questions on this already:
Node.js Mongoosejs Crud scaffolding
Admin panel for Node.js and Mongoose
Is there a CRUD generator for Mongoose and Node.js and Underscore? Or a CRUD generator for a similar stack?
There are a few awesome answers in this set of links, including:
#jsalonen's answer gathering up some tools <-- mostly about generating admin UIs
#Dow's answer with some tools <-- he mentions RailwayJS (now CompoundJS), then points to some other SO questions/answers on this topic.
#bergie's answer about a module that exposes JugglingORM models as RESTful API routes automatically
Or, as #Andbdrew mentioned in the comments, there's node-restify
You could write your own generator - perhaps you could write a Cake task that would take a template file, execute some Javascript and output a view for your application. I started down this path recently myself. Certainly with the variety of technologies Node.js apps involve (different ORM choices, Javascript front ends, CSS layouts) this may make sense.
For the last option - an opinionated rapid web development Node.js framework that provides good API support, there are a few options:
#abject_error's answer, in this question, about Sails
Geddy <-- automatically provides .json versions of the data your controller specifies (depending on the request it uses this data to render HTML views or creates a JSON representation)
There's a nice slide-show on How to quickly make REST APIs with CompoundJS, so CompoundJs may fit your tastes.
I initially left these off as I assumed you may have an existing project, or didn't want to use an opinionated framework, but added them because why not.
SailsJS (https://github.com/balderdashy/sails) is exactly what you're looking for. It uses the Waterline module for simulating ActiveRecord. Just define a resource, and it will automatically create JSON endpoints for all RESTful actions, and also makes the endpoints compatible with Socket.io connections.
It's built on Express, so you can use any Connect middleware to extend it. AFAIK it's the best NodeJS framework for building API backends.
Defining a new resource is as simple as sails generate user. This will create the appropriate model and controller files, which you can then modify.
Keep in mind Sails was built with schema-less datastores in mind, so it's primary support is for MongoDB, not MySQL. I'm not sure how well (if at all) it supports SQL databases.

Gem to track User Activity [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there a good gem to track/log user activities on the site? Like when they sign in, sign out, or perform an action that changes something on the site (non GET requests in general).
Yes there are. Here is one, paper trail. https://github.com/airblade/paper_trail
Its main prupose is to versioning models but I think its also good for your use case since it registers who made each version.
For more gems search at ruby toolbox. Here are the categoties that you should check in this case
https://www.ruby-toolbox.com/categories/Active_Record_User_Stamping
https://www.ruby-toolbox.com/categories/Active_Record_Versioning
Maybe Userstamp is actually better for your use case.
This is a follow up. I've been using a gem called public_activity. https://github.com/pokonski/public_activity. It's pretty simple to install and setup.
I briefly investigated several similar-purposed gems including: PaperTrail, Vestal versions, audited, Acts as versioned, Userstamp , and found that:
PaperTrail, Vestal versions and Acts as versioned are all very powerful versioning gem. Yes, you can also use it to audit/track users' activities , but it's not very straight forward because they are 'versioning tools', but not for the 'auditing purpose'
Userstamp and audited are for auditing purposing only. but Userstamp is for older Rails versions ( it's a plugin... which is not supported by Rails3(or 3.1, 3.2?) anymore )
so I think 'audited' is a better choice for auditing user activities purpose (not considering model versioning) for Rails3, this is enough for me. Further more, it supports associations and ActiveRecord/MongoMapper.
I hope this helps.
paper_trail is usually used to track changes in object.
If you want to track actions (like a movie, sign in, read a book etc) pfeed
is a good candidate
There is a ruby gem called Action Tracker. I built and use it and it should do exactly what you need (since you use Rails and Devise).
The link is https://github.com/appprova/action_tracker
There are some contribution from outside our core team too (people are using it). You are welcome to try and send feedback!
It depends on why you are looking for those informations. Papertrail or similar can track changes in models easily, see Siwei Shen:s answer for better infos. Also public_ativity type of gems can be used if you are looking on how to make a public feed based on user actions.
Then again if you wan't to do growth hacking or analyze otherwise what are the user flows. It's often easier just to do some custom logging. Create a long text field next to the model and add a line every time something interesting happens. Works well if you wan't occasionally to crunch some data on how users are using the service and how changes in the site affect long term usage.
See https://github.com/holli/referer_tracking for example of this type of approach.

Web application backend - confused with options [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm looking to start on a project web 2.0 app for a bit of fun. I'm a little confused as to what sort of backend I will require. The site revolves around a user submitting an item, then other users submitting responses, then rating each response up or down. That sounds a little like digg.com I realise. How do I go about tackling a project like this? Is a ruby-on-rails + MySQL solution a good way to start? I've also read it could be developed using wordpress :S
Are there any guides/documentation/global-tutorials for this sort of thing? I'm very new to web applications and am using this as a learning tool.
Dom
First things first, when starting to learn something like this, read a book.
If its Rails you are interested in, you could probably skip buying a book on databases, but would advise:
'Agile Web Development with Ruby on Rails' - http://www.amazon.com/Agile-Web-Development-Rails-Programmers/dp/097669400X
'The Rails Way' - http://www.amazon.com/Rails-Way-Addison-Wesley-Professional-Ruby/dp/0321445619
For online guides, Rails has its own 'Rails guides' - http://guides.rubyonrails.org/
For a free guide to Ruby you could try the online pickaxe http://whytheluckystiff.net/ruby/pickaxe/
The plus side to Rails is that you have a Ruby API to access your database (in the form of ActiveRecord) where you can skip out (initially) on learning a lot of SQL (not recommended for performance applications, but good for starting with).
My advice is to learn this stuff before you go on to AJAX.
Oh, and skip web development on Windows, go install VMWare Server and install any distribution, though, for ease of use try Ubuntu (unless you are already on a Linux machine / Mac), it will save you lots of development headaches later on, though may be a pain initially. There are guides for getting set up for this all over Google.
As for your question on databases, even though the books may suggest using sqlite, try and avoid it, and go for something like Postgres instead of MySQL, the benefits will become obvious to you once you start looking at more advanced SQL stuff.
You basically need 3 things to build a site like you're looking for.
1) you need a database to store the state of your application. Something like MySQL or MSSQL Express Edition.
2) you need a server side technology like PHP or ASP.NET to handle the communications between the web browser and the database.
3) you need some javascript code in your browser to capture the events and inputs from your users.
A basic flow might look like this:
A user navigates to page and clicks a button which raises a javascript click event. The click event handler makes an AJAX request back to the PHP code running on the server which saves the data to the database.
Use whatever technology you have some familiarity with or whatever you would like to learn. You can do bad job or great job with any technology at hand.
From the description you provide, it should not be that complicated, but you will definitely need to learn some HTML and CSS, and later JavaScript.

Resources