Rails App in a Subdirectory

Run rails app under subfolder

Try setting config.relative_url_root in config/environments/production.rb:

http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root

How to Service Objects in Subfolders

You can do that in two ways.

If you want rails to autoload them without you making any modifications to the config.autoload_paths, define your classes per the folder structure as follows:

module Gen
class ServiceA
end
end

If you don't want to make any changes to your class definition, then you could add those sub folders to the config.autoload_paths as follows in your config/application.rb

module YourApplication
class Application < Rails::Application
config.autoload_paths += [
"#{Rails.root}/app/services/gen",
"#{Rails.root}/app/services/prod"
]
end
end

Deploy a rails application in a sub-directory with Passenger

I moved my application to subdir/

I created a .htaccess with :

PassengerEnabled on
PassengerAppRoot /path/to/railsapp/subdir

And my VirtualHost :

  DocumentRoot /path/to/railsapp/  
<Directory /path/to/railsapp/subdir>
AllowOverride All
RailsBaseURI /subdir
</Directory>

Thanks AlexD for trying to help me.

Merge 2 Rails App subdirectories keeping git history

✅ [SOLUTION]

Finally I found a solution very similar as @matthewd propose, Thanks @matthewd.

What I did is prepare my source app to merge it directly to target app.

For each subfolder I wanted to merge, in source dir. I did :

in source/ $

1) Remove remote just to prevent remote changes.

$ git remote rm origin

2) Filter repo with the directory I want to merge (e.g. directory: app/controllers)

$ git filter-branch --subdirectory-filter <directory> -- --all

3) Prepare subfolder

$ mkdir target
$ mv * target

e.g. app/controllers/target

4) Add and commit the changes

$ git add --all
$ git commit -a -m "Controllers added"

Then:

in target/ $

1) I added the remote referenced to my local dir with the previous changes.

$ git remote add source <../target-dir>

1.1) Create a branch to work with.

$ git checkout -b new-branch

2) And pull the changes using --allow-unrelated-histories to my repo which if we created a correct subfolder should not have conflicts.

$ git pull source master --allow-unrelated-histories

And thats all, just push the changes to your current branch

Rails assets are in a sub directory and cannot load in production

You just need to add events to your precompile assets list since its not compiled with application.scss the format you want is

config.assets.precompile += %w( pages/events.scss )

then

bundle exec rake assets:precompile



Related Topics



Leave a reply



Submit