Peter vande Put
Joined
Activity
I'm building a portal to manage our server farm.
I need to create an SSH connection and then execute some commands (bash scripts)
however this commands block the SSH process
sudo -u deployer -H bash -l
how can i resolve this?
I have some sidekiq workers and they work great in production but in development I'm getting errors like
NameError: uninitialized constant TicketAssignedWorker..
sidekiq.yml
:concurrency: 6
:pidfile: ./tmp/pids/sidekiq.pid
:logfile: ./log/sidekiq.log
:max_retries: 5
:queues:
- default
- [high_priority, 2]
Hi Chris,
Yet another good tutorial you made. I must say I always use option 1.
I don't like moving logic to JS if not needed because more dependencies and more code
Posted in Protecting source
I'm looking for a way to protect source code using a license server. Since ruby is not a compiled language looking for any experience with compiling ruby using rubyVM or other means.
Posted in Render before action completes
Julian looks nice one question I wanna show a spinner while building my variables which are about 20 which are rendered as graphs
How should I use your gem for this
Posted in How do I find a Rails mentor?
Hi Daniel,
I've 35+ years of software engineering experience and long time with rails.
The last 15 years where mainly architecting software.
Please contact me by private mail to vandeputp@gmail.com and we can discuss and schedule a call to discuss your expectations and how I might be able to help
Posted in Render before action completes
Controller action is taking a couple of seconds (complex calculations in dashboard) and i want to display a spinner on the html.erb file while waiting so basically start the rendering before the action completes. How can I do this?
I have an application using ActionCable broadcasting to about 100 TV screens when a new event happens.
This works great on local machine but on server (centOS, NGINX) I see a lot of Broken Pipe messages and many screens don't receive the updates.
Would this be a better solution or have the same problem since it's using the same technology under the hood? Please advice
Posted in Root route bypassing before_action
we have a posts_controller which takes a slug to render the correct page.
posts_controller inherits from application_controller which has a couple of before_actions
routes.rb has the following root
root 'posts#show_post'
The before_actions are not called when going to localhost:3000 which renders the correct post.
also in the log i don't see the show_post action being called.
What am I missing here?
In our application we generate several reports. Instead of downloading them as Excel or CSV want to render them similar to Excel/Google sheet
anyone any ideas what the best approach is?
In our system we are sending webhook to an endpoint with serialized JSON for the object JobApplication.
The JobApplication has a resume attached using ActiveStorage. ( has_one_attached :resume)
How can I return a public URL to the resume in my JSON
class JobApplicationSerializer
def self.exploded_json(object)
json =object.to_json(:except => [:user_id,:created_at, :updated_at],
:include => [
:state => {:only => [:id, :name,:code]},
:country => {:only => [:id, :name,:code]}
]
)
return json
end
end
app has a consumer facing part and large backend/CMS part.
our assets (JS and SCSS) are precompiled into a very large file
in layouts we have a different layout for front- and backend
Is it possible to split assets:precompile into a front end and a backend part?
using asset_sync gem and fog
in our app we have an image library which stores images in S3 linked to cloudfront.
cloudfront configured for http2
server is puma + nginx
problem is performance seems like all assets served from cloudfront/xxxxxx are using http1.1 instead of http2
how can this be solved?
We have a requirement where are rails application should be available on multiple domains like abc.com and xyz.com
based on domain it will only show a different logo all the rest is identical.
What's the best approach for this ? all tips are welcome
What I do is copy the production bucket to the staging bucket from time to time.
Have a simple Ruby script to do this.
Posted in how to model on rails that a supplier can be a customer and a customer can also be a supplier. ?
Your model is wrong it's better to have a model named partner for example which has a partner type. Now you can seed it with partner types like Vendor, Customer, Supplier Both, whatever you want
class CreatePartnerTypes < ActiveRecord::Migration[5.2]
def change
create_table :partner_types do |t|
t.string :name
t.timestamps
end
add_index :partner_types, :name, unique: true
end
end
class CreatePartners < ActiveRecord::Migration[5.2]
def change
create_table :partners do |t|
t.references :company
t.references :partner_type
t.string :name
t.string :address
t.string :postal_code
t.string :city
t.references :state
t.timestamps
end
end
end
- Make sure to work from different branches in git (e.g. master branch is on your production server and develop is on your staging and local)
- Do not make changes to your to exisiting migrations, if you need to change/create models create a migration for it.
- In case you add a field to a modal and you are using it in a control flow make sure to set a default value
- New Controllers/Views can be added like normal
- After local testing deploy to your staging server * git pull * rails db:migrate * start your server
- If all is verified do the same on production from your master branch, restart your services
My system is using a post model with friendly_id so the calls are /name_of_the_post and this works great.
The initial home page is also a post so in routes.rb I have
root 'home#index'
get ':slug', to: 'posts#show_post', as: 'show_post'
```
My HomeController has the following index action
```
def index
redirect_to '/home'
end
```
The PostsController will pick up home slug and show the post, however my URL is now localhost:3000/home and I want it to be
localhost:3000/
How can I achieve this stripping the home slug (only for home)