Vikram Sharma

Joined

480 Experience
3 Lessons Completed
0 Questions Solved

Activity

Posted in Rails 7.1 Authentication From Scratch Discussion

Great episode.

Posted in Law of Demeter and Delegation Discussion

Great video. Nicely explained.

Posted in Deploy Ubuntu 20.04 Focal Fossa Discussion

I faced same issue but with mysql. So I removed the configuration from .rbenv-vars and created shared/config/database.yml.

Posted in Deploy Ubuntu 20.04 Focal Fossa Discussion

Yes. You need separate nginx server configs for each website. Make one server the default.

/etc/nginx/sites-available/foo.com.conf

server {
listen 80 default_server;
listen [::]:80 default server;
server_name foo.com;
# more config
}

/etc/nginx/sites-available/bar.com.conf

server {
listen 80;
listen [::]:80;
server_name bar.com;
# more config
}

Posted in How to use ActionText in Rails 6 Discussion

Great tutorial Chris,

I could not get the image preview centre aligned till I changed my css to the following

.```
// actiontext.scss
form-control {

.attachment--content {
margin: 0.6em 0;
}

.attachment--content {
width: 100%;
text-align: center;
}

.attachment {
display: inline-block;
position: relative;
max-width: 100%;
margin: 0;
padding: 0;
}
}

Hi Chris,

Another concern is the location of custom javascript. I am new to Rails so please excuse my ignorance.
In Rails 5 we would add custom js to their own .coffee files. For Blog model I would write custom js in blog.coffee file and so on.
In Rails 6 all javascript gets added to a single file i.e application.js
How can I keep them seggregated?

Posted in TypeError: $(...).chosen is not a function

I am using Rails 6. I have installed jQuery, Bootstrap, & Popper as explained in one of the videos and Bootstrap is working fine. Now I have to use Chosen jQuery plugin.

I installed it using Yarn

yarn add ssh://git@github.com:harvesthq/chosen.git#7149a2aed86d4d815f1497f27ae602ed898b9b02

which outputted

yarn add v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.8: The platform "linux" is incompatible with this module.
info "fsevents@1.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > webpack-dev-server@3.3.1" has unmet peer dependency "webpack@^4.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.6.2" has unmet peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ chosen@1.8.7
info All dependencies
└─ chosen@1.8.7
Done in 158.62s.
In environment.js I added
environment.plugins.append(
  "Provide",
  new webpack.ProvidePlugin ({
    $: 'jquery',
    jQuery: 'jquery',
    Popper: ['popper.js', 'default'],
    Chosen: ['chosen.js', 'default']
  })
)

In my application.js I have

document.addEventListener("turbolinks:load", () => {
  $('[data-toggle="tooltip"]').tooltip()
  $('[data-toggle="popover"]').popover()
  $("#course_instructor_ids").chosen()
})

Which gives me the error (in web console)

TypeError: $(...).chosen is not a function[Learn More]

If I add the following to application.js

import chosen from "chosen"

I get

Error: Cannot find module 'chosen'

Any help will be life saving :)

Try Chris's hatchbox.io
I have seen the "How it Works Video" and I am very impressed. I am not a dev op guy and not very comfortable with Capistrano and Chef. I have multiple Rails Apps to manage and I think Hatch will do a lot of "dev op" work for me leaving me with time to focus on shipping products (I do an app every couple of months or so and a major app every 6 months to a year."
I am hoping Chris offers his GoRails subscribers a discount coupon ;)
Regards
Vikram

Thanks for the help buddy.

Hi,

I want to create a web app which is a simple HR SaaS. Each user/company which registers will have get a separate table to upload list of employees. In terms of autorization a user/company can access only their table.

It is possible/advisible to take this approach in Rails i.e.

  1. A user can create their own table in database
  2. User can modify columns of the database

Thanks for the help.
Regards
Vikram