Ruby on Rails, AJAX examles - ruby-on-rails

I'd like to know what people think what websites are good examples of AJAX with Ruby on Rails at the moment.
I'm learning both and would like to see some good interesting examples of what can be done.
THanks,
Joe

http://haystack.com/
http://rubyonrails.org/applications
These links will open a new horizon for you.

Perhaps grab a copy of http://www.redmine.org/ and look it over. Maybe not the bleeding edge of ajax but there is some good stuff in there all around for rails development. I learned a lot from it.

If you're just getting started and interested in unobtrusive AJAX with jQuery, I have a blog post you might be interested in. Basically it takes a simple scaffold generated site and adds unobtrusive deleting with jQuery step by step - if that sounds like something you'd be interested in feel free to check it out.

Twitter.com is an excellent example of what can be done with AJAX. I believe the site is coded in Ruby on Rails as well.

Related

Getting more Ruby On Rails Helpers

I am completely new on Ruby On Rails and I already watched a long tutorial to start developing a small web application. In such a tutorial I could see several helpers for textboxes, textareas, dates, times, checkboxes, radiobuttons, comboboxes, and so on.
Where can I find other helpers like accordions, WYSIWYG editors (like an HTML editor), and others that can be bound to data from model and used in views? Maybe a toolbox for example.
I will very much appreciate your feedback.
Best regards.
What you're mostly talking about are Form Helpers. There are a bunch of other Rails Guides so I'd recommend reading through them and getting a better idea of what Rails does and can provide.
If you're not finding what you need in that documentation, you may need to add a 3rd party gem to your app's Gemfile, and follow the gem's documentation for getting it working. The Ruby Toolbox is a good place to start searching if you want to see which gems are most common.
And, of course, in the end you might not be able to find something that someone else already wrote and that solves your problem, in which case you will need to write it yourself. For front-end stuff you'll want to get up to speed on how to use HTML, CSS, and Javascript.

Does Ruby on Rails affect how a web page looks?

Most of the time, whenever I hit a website that looks "bubbly" in nature, and all prettified in those pastel-like colors, I think to myself, "This was probably done with Rails." And, lo and behold, after some digging into the site's information pages I discover this is actually true. So, I pose the question, not knowing much about Rails but enough about Django to understand how the database stuff works:
Does RoR have any display-specific qualities that affect how a web page looks? Or do all RoR devs naturally use the same Adobe tools to make everything look so ubiquitous?
Ruby on Rails is a server side technology, so it doesn't lend any specific quality to the user visible design. That said, it is a "trendy" technology so people who are likely to write their back-end code with RoR are likely to choose a particular "Web 2.0" style for their views.
As a Ruby on Rails developer, I can tell you that most Ruby on Rails developers are passionate about their work and we pay a lot of attention to details when building websites as much backend as front end. Its not just a trend, its a way of thinking and working.
No, it hasn't any display-specific qualities.
The theory is that RoR makes that backend stuff easier, so more time can, and apparently is, spent on the front end stuff.
Its all done with Mirrors. And CSS. :)
Rails is a very popular Web framework, it's just be coincidence that all the ones you've looked at have been rails apps.
What kind of sites have you been looking at to draw this hypothesis?
that's a funny question with a funny description :) ... bubbly!
As a madman, I develop with RoR, it's kind of rule in our area. We learn madness from the beginning, as a result of http://railsforzombies.org...
May wise men follow a wise path!
Short Answer: NO
However...
As a Rails developer I can say that due to the Agile nature of Rails and the speed in which you can develop web applications with Rails I do find myself having more time freed up on a project to spend polishing the user interface. I believe this may be a reason you often see more polished looking Rails sites.
So in my mind I believe your choice of framework can have a direct correlation to the end product that is produced!
Rails does add some stuff to the front end. Like to every html form, it will add a hidden input element authenticity_token.
You can also tell because rails URLs and form actions will never end with suffixes like .aspx or .php or .html or .jsp, and they won't usually append ?query=book&encoding=utf8 like you see on google. And they won't usually have superlong crufties like you see on amazon (eg http://www.amazon.com/Agile-Web-Development-Rails-Ruby/dp/1934356549/ref=sr_1_1?ie=UTF8&qid=1297922135&sr=8-1). Instead Rails prefers simple routing URLs. If amazon were written in rails, you might instead expect amazon.com/books/Agile-Web-Development-Rails-Ruby
So there are ways to spot a Rails app. I expect other web frameworks, especially the ones that emulate rails, would duplicate some or all of these features, so this isn't a sure-fire method, but it helps.

Rails plugin to separate markup and logic, like Wicket or Effigy

I need a Rails plugin that gives you the chance to purely separate HTML and any logic in your views. Views should be classes reading the separate markup and replacing it with dynamic content where needed.
Basically Effigy from github does this.
I am looking for something like Wicket, but on the Rails base.
I can remember seeing a plugin from a Rails enterprise that does this. In my memory, it was better and seemed more mature than Effigy. But I forgot its name. It was something like "luxurious" or "delicious"; does anyone know what I am talking about? The plugin was created in a US Rails enterprise.
Any other alternatives would be much appreciated.
I feel that Effigy is almost OK, but it's hard to find tutorials or people using it properly, so I question its the maturity.
Well, if nothing comes up, I will go ahead with Effigy for now.
All right guys, I think I finally found what I was talking about.
The plugin is called "Erector"
The thing that I like about it, is that views are finally plain ruby objects and you can do everything you can usually do in ruby. I found couple of blogposts:
https://github.com/erector/erector
Why I always liked this idea you can easily see in this blogpost
I want to thank the creators for this.

Ruby on Rails customer-facing formbuilder?

I have a customer that wants to build their own questionnaires. Something like WuFoo (www.wufoo.com) but more secure and contained within the app.
I've looked at Smerf (http://github.com/springbok/smerf) which provides the yaml-to-form conversion, but I'd like something the user can use to create their own forms.
I would look at using active_scaffold. The main version has not been updated for Rails 3, but a fork at the location below has. I think it would work well for your purpose, you just need a way to grab the data and feed it in. Here is a demo of what it looks like when it is running:
https://github.com/vhochstein/active_scaffold
Here is a demo at the top of the page:
http://demo.activescaffold.com/roles
You could always embed Google Forms. Might be easier than reinventing the wheel. Unless you have some specific use case this doesn't cover?
If you are not adverse to going the Javascript route the then you might consider one of the many framework plugins like the JQuery Form Builder. From a usability perspective it seems to me that any good solution is going to involve some Javascript. There should be no reason why this approach wouldn't integrate well into a Rails backend
You might want to check out this one. Dynamic Forms
I too am looking for something very similar. What solution did you come up with?

Voting Functionality Ruby on Rails - Easy Question

I want to add a "like" functionality to a blog I am creating in Ruby on Rails to let people "thumbs up" a post. Then I would like to be able to display the most liked posts in the side bar. I am new to rails so rely heavily on tutorials and stack overflow. Any good resources or what is this even called. I assumed "voting" for this question.
You should look up link_to_remote and using AJAX with rails. Here is a nice tutorial to get started: http://railsonedge.blogspot.com/2008/03/tutorial-beginning-ajax-with-rails-20.html
The idea would be:
The user clicks on "vote"
It sends an asynchronous message to the controller to save the vote. (use link_to_remote)
the :complete callback does something (eg "thanks for voting!")
the :update changes the voting zone (eg "voted. 6 votes on this")
There are a lot of tutorials on the subject.
EDIT: I wrote that a while ago and since then the best practices have changed. Now please take a look at how to do that using unobstrusive javascript. Good resources include Ryan Bates Bates's railscast #205 and the wikipedia article to understand the principle.
"Unobtrusive JavaScript" is an
emerging technique in the JavaScript
programming language, as used on the
World Wide Web. Though the term is not
formally defined, its basic principles
are generally understood to include:
Separation of functionality (the
"behavior layer") from a Web page's
structure/content and presentation
Best practices to avoid the problems
of traditional JavaScript programming
(such as browser inconsistencies and
lack of scalability)
Progressive enhancement to support
user agents that may not support
advanced JavaScript functionality[
I know this is not exactly what you are looking for, but there is a very good "star-rating" plugin that you could look at for some ideas of what to do. It uses ajax and all that goodie-goodieness ;)
The book Simply Rails 2 has something similar to this (a vote up, vote down sort of thing) and you might want to pick it up just because it is a good book to get you started on things.
Simply Rails 2.
gem thumbs_up for rails 3 or gem vote_fu for rails 2.* applications can help you...

Resources