I'm new in Ruby on Rails, I'm wondering, is there a user interface to see all the data that you have in your Active Record Models and manipulate them just like PhpMyAdmin?
Sadly no - you have to write that interface yourself... :)
There are ways to quickly scaffold up an interface for each of your models. Look at doco on rails generate scaffold for more info.
There are also gems that will automate some admin-scaffolding for you:
Look at eg ActiveAdmin
But in practice nobody keeps either of these around for long in their projects (for various reasons).
If you're new to Rails, I can highly recommend reading your way through the Rails Guides here: http://guides.rubyonrails.org It will help you level up in all the fundamental aspects of Rails :)
There are gems in rails to maintain tables in rails app:
ActiveAdmin: It provides admin panel using which you can add/update/delete any record under tables.
rails_db_info: Just and it under Gemfile and run bundle install. Go to "/rails/info/db" link, it will list all tables with schema details. Its very easy to integrate.
So I've been reading tutorials and trying to understand the differences between a ruby gem, a rails engine and a rails plugin however it is not completely clear which path to take.
Say I wanted to make an extension to rails which needs access only to active record within rails.
Should I do this within a rails engine? It seems overkill since I won't be needing routes, controllers, or views just a way to create models which exist within a database. Or do I make a gem that requires rails be installed? and if I do go that route is it possible to have db migrations within the gem. What happens if I just require ActiveRecord? Will others still easily be able to integrate my gem within their own projects?
It would be nice to know that if I do make a gem it is not required that the users absolutely have to have the full rails stack within the application they are working on.
I want to build my application in a modular way: For example I might have:
Users->has_and_belongs_to_many->Projects
Users->has_and_belongs_to_many->Tasks
Projects->has_many->Tasks
Tasks->belongs_to->Project (1 task belongs to 1 project.)
Note: Projects AND tasks can have many users.
The way I was thinking of building this is by doing:
User = Gem
Projects = Gem
Tasks = Gem
Each can return either json (for ember) or html. Neither depend on each other, The idea is that each is just a detail. Rails, ember and html are all just details.
How could I go about this and at the end of the day hook them together like a puzzle? or is this even feasible?
Right now I have the user piece of this concept almost done. It contains models, tests, controllers and views. Can I bundle that as a gem or should I only bundle the controller and the models? This "User" gem would make use of friendlyId gem to make the urls look nice, infact all the "gems" (project, tasks and users) will depend on this gem.
What would you recommend to do to have the kind of modularity I want? is it good practice? bad practice?
Pivotal Labs made a presentation (Euruko 2013 in Athens) and they showed a rails engines approach similar to what you are describing. Here is the presentation http://www.ustream.tv/recorded/35107339/highlight/377037
I haven't seen it in practice though, but I would like to.
I believe use of Rails engines is the way to go.
Each Engine can be an app in itself.
For instance Devise - gem that adds a lot of authentication functionality into your app is a Rails Engine. It provides its own controllers, helpers, mailers and views that you can use from your app.
I personally was working in projects that were using Engines to plugin i18n web backends (admin page that allows entering and saving translations to Redis) into many apps and to plugin users' bug reports and Question&Answer functionality into several existing projects.
Each engine is being included in a project as a gem, it can consist of anything that normal app does - controllers, views, models, assets, other gems...
I personally haven't heard of any success stories with such approach (but I don't know if anyone tried though), so if you have a solid concept in mind maybe it will work for you.
I'm looking for a simple quiz gem in Ruby on Rails. It needs to present the user with multiple choice questions (radio buttons, checkboxes only), tally up the right/wrong answers, and display the results at the end. The quiz will be about 25 questions - 1 question per page. It also needs to integrate with the site I'm building, so it can't be a standalone site, or third-party site.
So far I've found this gem, which looks promising:
https://github.com/NUBIC/surveyor
Anyone know of any other Quiz gems in Rails?
The surveyor gem is quite powerful and I can recommend it. There is one thing that you should note: you write the survey in a dsl (ruby file with special, easy to understand syntax) and then run a rake task. This means that it's very useful for a one-off survey, where a developer can generate it (much easier and faster than doing it manually), but not if you want a non-technical person to generate surveys on her own.
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 4 years ago.
Improve this question
I am starting to learn Ruby on Rails. I have an application in mind that I would like to create, but I know I'm going to have to repeat a lot of the things that have already been done a million times (such as user authentication, etc).
I just found out about rails templates. From what I understand, you can use one of these templates to create a new rails application and set up a lot of the basics. Where can I find some of the most popular templates, and should I use one of them?
Andrew, if you are starting to learn RubyOnRails and have an application in mind, I suggest you DO NOT use any templates at all and do it by hand.
Rails templates primarily pull in gems and other external dependencies (plugins) into your app. The primary benefit of templates is for people who build so many Rails apps so often that they'd like to get bootstrapped really quickly.
You would learn more and feel much more confident about the whole process if you consciously chose the plugins/gems you need and progressively added them to your app.
Devise (popular authentication gem) goes so far to say, that if you are starting with Rails app, you should NOT use it.
Here's a more current answer which applies to Rails 3 (the other answers are all from January 2010).
After playing around with editing application templates for a few months, I've found it can be a headache to assemble and maintain a application template. It helps to have a collection of "recipes" that can be maintained individually, then assembled into an application template.
I'm using the
rails3_devise_wizard
which is a version of the RailsWizard gem with custom recipes for a Devise starter app.
I've used it to create two application templates:
Rails 3 + Devise + RSpec + Cucumber Application Template
Rails 3 + Devise + RSpec + Cucumber + Mongoid Application Template
which generate the following example apps
Rails 3 + Devise + RSpec + Cucumber Example App
Rails 3 + Devise + RSpec + Cucumber + Mongoid Example App
and each has detailed tutorials showing how they're built:
Rails 3 + Devise + RSpec + Cucumber Tutorial
Rails 3 + Devise + RSpec + Cucumber + Mongoid Tutorial
Jeremy McAnally maintains a diverse collection here: http://github.com/jm/rails-templates/
I don't think there are any silver bullets, but they display a lot of techniques that templates allow.
Rails Kits may also fit your needs, even though they're not actually Templates:
http://railskits.com/available-kits/
There are several ways to extend a Rails application and/or start one off. You've mentioned just one of the big four. The others are:
Plugins
Engines
Gems
Templates
Templates are generally used to start out an application, but if designed correctly, you can use them to extend one. For example, many stock templates out there help setup a code repository, install a few plugins/gems, and perhaps fix up the layout a little so you don't have to. Of course, you'll usually do most of these when you first start out a project. At our company (3 developers) I created a template that sets up our dev and production environments, repositories, project tracking. Here's my favorite stock template: http://github.com/lhoeg/app_lego/network
(The original hasn't done much work on it in a while, and I believe this is the best fork out there now)
Plugins and Gems are more or less becoming synonymous and there's little reason any more for people to create plugins, as gems are the more Ruby-standard way to package functionality. Generally you'll use plugins to add bits of very specific functionality to your application. This can range from adding user authentication, to calendaring, to adding locations and mapping to your app. Most plugins that I've used extend the ActiveRecord or database part of the application. If the plugin comes with views, controllers, or modifies your database tables it'll usually come with a generator. A good example is the Restful Authentication plugin's generator. A relatively good list of http://agilewebdevelopment.com/
Engines are the kings of modularity. They usually provide a lot more functionality than plugins. Whereas plugins and gems generally extend Rails itself, Engines are intent on extending YOUR application by adding a full set of views, controllers and models. Thus engines are entire Rails applications packaged into a neat little box that you can just plop into your app and instantly add a bunch of functionality. There's also an Engines directory at http://agilewebdevelopment.com/ but as you'll see, there aren't very many.
Hope this helps!
Berns
Try to search on github, there are really a lot of cool stuff. http://github.com/search?langOverride=&q=rails-templates&repo=&start_value=1&type=Repositories
If you search a example of authentication try to search a authlogic-example on github.
Ryan has some Rails templates: http://github.com/ryanb/rails-templates
It seems Jeremy's repository gave me a 404 when I tried it.
We have developed a Rails application template.
https://github.com/agilie/Rails-Application-Template
For now it contains testing, deploy, documentation generation functionalities, sidekiq, redis and much other gems and stuff.
It is fully customizable and you can easily enhance it for your needs. Feel free to fork and make some pull requests.