Sample/Dummy Data Generation in Rails 3 - ruby-on-rails-3

Is there a standard gem for creating data for testing purposes for Rails 3?
I am interested in using Faker or Forgery but is there a better approach?
What is the best way to generate and use sample data?

The two I'd recommend using would be factory_girl_rails by Thoughtbot and faker. These are by far the best two for generating sample data.

Related

Symfony2 API with tables without entities

I have legacy code that has DB connected.I'm trying to add new features for this app with Symfony2. I used Theodo Evolution Bundle to access the legacy session.
First thing that I want to do now, is to build an API that will use data from existing database. This database has tables that are not converted to entities. My question is which is best approach in this case. To use native queries from existing tables in database to build API or to convert tables into entities I used documentation for this part but I'm not sure will import all relations and everything) and then to build API. Can you please suggest me which is best approach in this case. Thank you.
The best approach in my opinion is to work with doctrine entities within the framework and to avoid direct SQL if possible. That is the basic philosophy behind frameworks such as Symfony: the database layer should be abstracted.
The entity-database mapping might be quite more of a hassle at first, because you can't rely on automatic tools to set it up, but once it's done it will be much easier to work out the rest of the application.

Sortable table helper for MongoId

I'm coming from the Cakephp world where there is the PaginatiorHelper that allows building sortable data tables quickly, and now I'm looking for similar solutions for RoR compatible with MongoId.
So far, this is the only solution I could find:
https://github.com/bogdan/datagrid
Is there any other that is active and stable?

SQL prepared statement gems for Ruby 1.9/2.0

Is there a specific gem for using prepared statements for a SQL database within ruby? I've used the mysql2 gem in the past, but from its hard to build native extension and its lack of prepared statements I do not think it is the right gem for me.
I am looking for suggestions for a new database to switch to in which the ruby gem is easier to build without the hassle, or a gem which supports prepared statements (or both!).
The purpose for this would be such projects which I would need to expose a protocol to the internet and it would check data which users can potentially tamper with against a database. For example a chat server which stores static registered channels within the database.
If there are no gems that have prepared statements or built in functionality to prevent attacks from unsanitized input, what would be the best way to attempt to sanitize user input before using it with any database.
Also to note that this if for ruby itself and not rails.
Thank you for any comments or answers that can lead to a solution to these questions.

Best way to get data from Rails 3 to Kendo UI

What is the best way to get data from Rails 3 to some of Kendo UI's data intensive widgets (mostly grid and graphs)?
Lets say I have a Rails model which has data I want to show in Kendo's grid. I imagine I will be passing that data via json. But there seems to be many approaches to passing json data (gon, backbone.js,etc). There is also the rails api approach (but I need the full rails for the other pages).
I was about to sit down and learn backbone.js. Is this a good approach?
Thank You
You just need to create an action that will serve your data as JSON. You do not need to use other JavaScript libraries. Take a look at this project, I think you might find it useful.

Acts-as-tree in Rails3?

I need to use Acts As Tree in my Rails3 project (ruby 1.9.2). But, there are lot of forks on github, so I don't know which should I choose, and which is used by other developers?
On Railsplugins.org there are http://www.railsplugins.org/plugins/376-acts-as-tree, but last commit was from March...
I'm using http://rubygems.org/gems/acts_as_tree_rails3. Works great.
I've gone with https://github.com/skyeagle/nested_set on my Rails3 projects. It's hard to say at this point where adoption will take things.
I'd suggest using https://github.com/mceachen/closure_tree if you can add a new table to store the hierarchies and want efficient select and mutate performance.