yaml_db | Rails plugin for a database-independent dump format | Database library
kandi X-RAY | yaml_db Summary
kandi X-RAY | yaml_db Summary
This repo is no longer maintained, please see for a currently maintained fork.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of yaml_db
yaml_db Key Features
yaml_db Examples and Code Snippets
Community Discussions
Trending Discussions on yaml_db
QUESTION
I am more of a Java programmer and still somewhat new to development (2 years or so, can write Java code & web apps just fine) however the company I work for has 4 Rails applications and was asked to get this application working called CtrlPanel. I have been having to learn Ruby on Rails in order to help get this issue with this app fixed and get it working.
I have been working on this problem for over a week all day long every day and nothing I do is fixing it.
I fixed everything to the point the app comes up, web server runs serves the pages but all views are white screens as long as this application.html.haml file is present. I re-wrote the file with very basic bootstrap and it sort of works but nothing looks right. The problem seems to stem from 1 single like that simply says: = javascript_include_tag "application"
I have been all over the internet and have tried every single fix from changing coffee-script-source to v1.8.0 as I read Windows has an issue with newer rails and that file, I have tried every variation of changing it from application to default, and every type of ending you can think of no matter what I do it gives me this error message which I can not seem to find.
I am not even sure WHAT that line does, I assume it has to do with the new Google Maps API and I verified the key is valid and it was working before.
This is the error is it giving it says the line with "= javascript_include_tag" "application" giving error ExecJS::RuntimeError at / SyntaxError: [stdin]:1:1: unexpected //=
I am running a PC on Windows 10 20H2 x64 UEFI ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32] Rails 6.1.3
(I did also install Ubuntu on another machine and it gives the exact same error, also gives the same error on another Windows machine)
The app is working IF I delete the "application.html.haml" file and put in a skeleton basic version all of the other views start working but of course none of them look right no menus no bootstrap no nothing.
Here is the application.html.haml file.
ANSWER
Answered 2021-May-04 at 18:59I did finally figure out what this was.
The older versions of rails in this case v4.2.1 used the javascript_include_tag for the line that deals with application:
= javascript_include_tag "application"
In the newer versions of rails in my case v6.1.3.1 you have to use javascript_pack_tag
= javascript_pack_tag
This solved the issue and the views all started working. I did mention above I was working on a PC running Rails v6.1.3; however I noticed I didn't make it clear that I was also having to upgrade this program from Ruby v2.2.2 and Rails v4.2.1 to Ruby v 2.7.2 and Rails v6.1.3, that might have helped to have made that more clear. Apologies if that confused anyone. I am still VERY new to Rails and using StackOverflow.com. I am happy to report I have only 1 single issue left on this program and the rest of the program is all working properly. I will be posting another question in fact because the last issue deals with a complicated scope query and it uses different syntax again due to the newer version of rails and I haven't been able to figure it out. In any even if you are running an older version of Rails and you are trying to get the program to work on a newer version (my case as I couldn't get rails v4.2 to run or work on ANYTHING, PC, Linux nothing) then you have to change the include_tag to a pack_tag. I do not pretend to say I fully understand why. I know it has to do with webpacker but beyond that I am still learning Rails. Perhaps someone with more knowledge than myself can shed some insite as to why the syntax changed. Oh and in addition the line ended up needing to read as follows:
= javascript_pack_tag "application", "data-turbolinks-track": "reload"
I didn't have the turbolinks reference either.
I hope this helps someone else in a similar situation that I was in, it was not easy to find. I only discovered it when I went through some tutorials on making other generic apps and saw the difference on that line.
QUESTION
using this command "git push dokku master" and deploy ruby on rails using Dokku on Digital Ocean getting me this error
...ANSWER
Answered 2019-Apr-11 at 06:01updating sql to gem 'mysql2', '~> 0.4.10' fixed the issue
QUESTION
I'm trying to push a forked repo to Heroku but Heroku won't accept the push because Ruby 2.3.1 wasn't accepted. I changed the version to 2.3.3 in the Gemfile and running bundle install --without production
, but oddly enough it was still considered to be 2.3.1. The same things happened even after trying other Ruby versions, such as 2.4.0.
Reference:
...ANSWER
Answered 2019-Mar-22 at 11:35Heroku doesn't support Ruby 2.3.1, 2.3.3 or 2.4.0
Look at your log:
QUESTION
The goal is for command...
bin/rails generate custom_scaffold Thing
... to generate the following 6 files:
...ANSWER
Answered 2018-Dec-28 at 23:09You need to specify the file as a Thor template. Rails uses Thor templates for generating templates with ERB style code inside them.
Replace:
copy_file 'model.rb', "app/models/#{file_name}.rb"
With:
template 'model.rb.tt', "app/models/#{file_name}.rb"
By adding the .tt
extension you're telling the generator to handle the file as a Thor template, which will interpret the Ruby code (ERB style) inside the file and then create a file with that same name minus the .tt
extension. Any file you have without the .tt
extension the generator will copy wholesale, without executing any of the code inside.
A useful tip: Sometimes you want to leave some ERB code inside a Thor template file without it being executed. By default any ERB style tags inside a .tt
file will be process and in it's place a string will be written to the output file. You can avoid the processing of ERB tags but using a double percent sign in the tag.
For example, lets say you have a file named foo.erb.tt
, which will create the file foo.erb
when your generator runs. Let's also say we have a article_name
variable and it's value is Breaking News
If you put <%= article_name %>
in the file it will write Breaking News
to the foo.erb
.
If you put <%%= article_name %>
(notice the %%
) it will write <%= article_name %>
to the foo.erb
.
I found the following reference handy when learning this stuff.
- Rails Application Templates article at Rails Guides.
- Creating and Customizing Rails Generators & Templates article at Rails Guides.
- Thor Actions Docs these are the commands used in our
template.rb
file.
Thor comes with several actions that help with script and generator tasks. You might be familiar with them since some came from Rails Templates. They are: say
, ask
, yes?
, no?
, add_file
, remove_file
, copy_file
, template
, directory
, inside
, run
, inject_into_file
and a couple more.
QUESTION
I have 2 Rails apps with the same models apart from a couple of attributes. I now need to merge these apps and I'm trying to work out how to merge their data. The challenges are:
- Conflicting ids. User from one app will have the same id as another user in the other app.
- Associated records. How do you keep associations when ids will need to change?
- Processing attributes that aren't identical. E.g. how do you make adjustments when one model is missing an attribute?
I'm aware of seed_dump and yaml_db but I'm not sure they're a good solution for my problem
...ANSWER
Answered 2018-Oct-04 at 17:35I faced a similar situation some time ago, with an app designed with database multitenancy. To merge all data into a single database I ended up creating a rake task, that would go through every record and association and recreate them in the new database.
The task had two arguments SOURCE
and DESTINATION
, and it would be run like:
rake db:merge SOURCE=some_database DESTINATION=new_database
. The task was run for each database I needed to merge.
Inside the rake task the idea was something like this:
QUESTION
RAILS 5.1
I have a RAILS application thats using PostgreSQL as database. I want to export/dump the RAILS database data from the RAILS perspective. So I'm independend from the database. Later then I want to use this export/dump file to load/import/seed the data back into the database.
I have tried the following GEMs:
seed_dump
It works, but it can't handle HABTM model relations.yaml_db , It works, but the yaml format is not the format understood by a rails db:seed
ANSWER
Answered 2017-Oct-22 at 21:03I would agree with the people saying use the built in database tools to do it. Or figure out if there's a way to tell the database to export to CSV, and then import that way.
However, if you really want a database agnostic way, here's another way: use your own API.
By that I mean that in 2017 your Rails app really should not just output HTML, but also output JSON. Maybe you want to write a SPA type app in the future, or a mobile app. Making sure there's a Javascript representation of the object, in addition to the HTML version, is a great idea.
So, if you have /projects in your app, write a script that requests /projects
as JSON. Save each object as its own file, then in your remote system post everything back in.
If there's anything not in the JSON representation (ie you don't list all the users on the project) make sure to hit those endpoints too and save everything to a separate JSON file.
Then write a player script that POSTS all those files to your destination service.
That's one way to do it. There other way is to write it entirely in Ruby in ActiveRecord - this might be useful as some kind of user data export functionality, so this could be an awesome way to do it too, but in my mind, "can we build a Javascript frontend or mobile app for this?" is usually asked way before, "can the user get their data out" ;)
QUESTION
I have a Ruby on Rails app which runs perfectly in development, but once deployed to production, puma fails to launch. I've been debugging and googling this matter all day, to no avail.
I've tried completely wiping this app off the production server and started over from scratch. Same result.
I've tried different versions of puma -- no difference.
I've tried ordering the Gemfile differently -- no luck.
I've looked up known issues with ckeditor, mini_magick and carrierwave and have not found anything helpful thus far.
The mekilacms gem is a version of Wellspring that I have modified for this project. I have not found anything about Wellspring that appeared to be relevant.
Honestly I'm running out of ideas. Would really appreciate some help on this one.
Here is the puma.error.log which shows the issue I'm getting:
...ANSWER
Answered 2017-May-14 at 03:05Well this is weird, but solved.
The 'process' method that puma has been griping about is normally defined in the uploader/processing.rb file in the carrierwave gem.
I say normally because in mine, it wasn't. Somehow I wound up with a malformed processing.rb file which did not contain 'process' (nor it's evil twin 'process!') as it should have. I've strained my brain over how this happened and can't really account for it.
Nevertheless, grabbing a good copy of the file and replacing my malformed one with it solved the problem.
Seems almost anticlimactic, doesn't it?
Anyhow, onward and I'd like to thank @Md.FarhanMemon and @SachinSingh for their taking the time to respond and ask questions.
QUESTION
I'm trying to move a postgres database between machines as I move from one development platform to another. I have yaml_db
gem installed on both machines.
On my old platform I do:
...ANSWER
Answered 2017-Jan-24 at 21:28You're copying a database, Rails really shouldn't have anything to do with the process (and as you're seeing, it just gets in the way).
Instead, put on your DBA hat and copy the database without bothering with Rails. Dump the data using pg_dump
and then restore the data with pg_restore
. The database's backup/restore tools know all about foreign keys, triggers, extensions, and anything else that Railsy tools don't understand.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install yaml_db
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page