Rails create defaults [closed] - ruby-on-rails

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 4 years ago.
Improve this question
I have an application I would like to sell to potential clients. When I deploy and install this application on their server I would like to have something that automatically creates some demo data.
Is there a way to do this? Or would that be done with seeds?

Yes, you can use rails scaffold to generate resources and yes you can use seeds to create demo data in your db.
You add any data that needs creating in your seeds.rb file and execute them using bundle exec rake db:seed.
see here for some examples on how to do it

Related

Is it possible to create a single executable file of a Ruby on Rails project? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
How to create a single executable file for any rails project.
Yes you can, using the gem ruby-packer.
Compiling a Rails application
rails new yours
cd yours
rubyc bin/rails
./a.out server (or a.exe server on Windows)

Prevent any database changes [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am working on production ruby console. I need only get some data, not change. But sometimes, if I use '=' instead of '==', I change records. If any suggestions for disable any changes (may by all database commits) when I start to work only with analyzing?
You can try:
rails c ––sandbox
Look more information: http://edgeguides.rubyonrails.org/command_line.html#rails-console
You could create another database user with only SELECT rights to the db.
Then in your database.yml file add a line with that user.
Create an empty config/environments/analyzing.rb file for this environment.
analyzing:
username: your_user
password: your_pass
And then access the console with rails c analyzing

Good practice to write a daemon for Rails [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I would like to run a websocket listener on the server to listen for message and update data or invoke worker accordingly. I would like to write it as a Rails module so it can update ActiveRecord and enqueue Sidekiq task seamlessly. What is the good practice in doing this?
I looked through many possible practices and found out that rails runner is the best for me.
You can also look for rake tasks.
And absolutely sure you can give a try to Faye-rails which will handle all the work without running separate workers explicitly.

how to run the rails example code present in github? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am trying to run the code present in https://github.com/binarylogic/authlogic_example.git but could not able to do. I have tried a few examples before and it went so good. I could not do the same with this. There is no gemfile and probably few things are missing. Somebody tell me how to execute this particular example.
The last commit is 3 years old on that repo so I doubt it is compatible with bundle and Rails 3. I would advise you to try devise for authentication instead os authlogic as with Rails3 that is the defacto auth gem.
Example applications: https://github.com/plataformatec/devise/wiki/Example-Applications

A tool to browse my rails app's database? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want a way to comprehensively view:
1. what's going on in my database
2. what the schema looks like
Is there a good tool that lets you do that?
There's a gem Active Admin that lets you do that: http://activeadmin.info/documentation.html
And of course you can use any other Administration tool that lets you connect to your database, for instance Squirrel http://squirrel-sql.sourceforge.net/ which connects to various sql databases, sqlite among them.
For development and testing, I would say the preferred way of knowing your data is generating it automatically using tools like FactoryGirl or Faker and look into schema.rb for the schema.

Resources