Activity
You might want to revert your foundation-rails gem back to the previous version, or see what's changed because it looks like the foundation/functions
asset no longer exists like it used to. They may have just moved it or renamed it.
I would use the database values. It's not going to slow you down to do that, since you'll already have the database records in memory to display them on the page. You can then do whatever you find easiest to change the buttons.
I would probably just use an if statement to check the different statuses of a user's invitation and then display different buttons accordingly.
Hey Mark,
It's a great question! Here we were skipping strong params. In either case, it'll accept any input the browser sends over. We're explicitly setting columns in this case which is safe.
The problem that strong_params prevents is attackers who add in extra fields into the HTML and submit something like user[admin]=true
that you weren't expecting. Strong params makes a whitelist of attributes it will accept, so if you passed in admin
, it will ignore it or throw an error.
Since we're explicitly setting a param to a column, it has the same effect. Rails added strong params so you didn't have to manually write all that out every time.
Posted in How is the Front End of GoRails Built?
Awesome right? It's super fast. Just make sure your Rails requests are fast too. I cache a lot and have it stored in redis (or memcached). That way Rails has even less work to do and can serve up things faster.
Posted in How is the Front End of GoRails Built?
It's just Turbolinks as usual. 🤠
I've never used Salesforce, so that makes it pretty hard to teach. I'll have to look into it sometime. Any pointers where I would start to check it out and what I could do as an example?
One important note to make:
Rails 6 will be using Webpacker by default for Javascript, so it will probably be getting rid of coffeescript as well. You might want to just make the upgrade now if you can so you'll have an easier time upgrading to Rails 6.
Your error is saying the variable you called ".onclick" on was null. The variable was the result of your getElementById, so it's saying it can't find that element on the page. I'd check that out.
Your Coffeescript looks fine, so I'd double check your HTML and make sure it has something with id="p"
in it.
You're right. Ideally you want the same version in both places that way what you run in development you know will work in production.
Let me know how it goes. You're pretty close. The first few times are always a huge pain with Capistrano.
Agreed, I can definitely see the confusion.
The whenever line is only needed if you're using whenever.
The second is just an example error message of what happens when you haven't created the database.yml file on your server yet. You should see a similar error.
Yeah, basically private projects need a ProjectUser association to keep track of who has access. A public one can ignore that since it's open to everyone.
If you're already using CanCan, keep using it. Pundit's just an alternative.
Devise invitable does have a method for doing that, it's in the docs somewhere. 👍
And glad I can be of help!
Interesting to see "LoadError: cannot load such file -- capistrano/rails"
Do you have the capistrano-rails gem in your Gemfile?
I currently have this:
group :development do
gem 'capistrano', '~> 3.11.0'
gem 'capistrano-passenger', '~> 0.2.0'
gem 'capistrano-rails', '~> 1.2'
gem 'capistrano-rbenv', '~> 2.1'
end
And my Capfile looks like:
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
# require "capistrano/rvm"
# require "capistrano/rbenv"
# require "capistrano/chruby"
# require "capistrano/bundler"
# require "capistrano/rails/assets"
# require "capistrano/rails/migrations"
# require "capistrano/passenger"
require 'capistrano/rails'
require 'capistrano/passenger'
require 'capistrano/rbenv'
require 'whenever/capistrano'
set :rbenv_type, :user
set :rbenv_ruby, '2.5.3'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
Yeah, spam check. Code looks suspicious. :) I'll unmark them as spam.
Nope, minor version changes are only bug and security fixes. That error comes from Capistrano, not Ruby.
Generally for that, you'd want a public
or private
boolean on the Project.
Then you'd change your query for finding the project. A high level example:
def set_project
@project = Project.find(params[:id])
# Private projects require use to verify the user has access.
if @project.private?
raise ActiveRecord::NotFoundError unless @project.users.include?(current_user)
end
end
Ideally, you'd use something like Pundit to do the authorization. That way it can be applied always and not be forgotten somewhere.
Hey Sam,
I'm assuming you've already went and re-run cap install
to regenerate your configs.
Can you post more of the stacktrace? Just seeing the error alone isn't that helpful. It's more useful to see where in the code the error happened so you can look it up in the Capistrano repo and see what it wants so you can figure out what you did wrong.
I'll be curious to see where it happened. It might just be a typo in the config or something changed in a newer Capistrano.
Also, don't worry about secrets.yml. You'll need to symlink master.key on your server though so it can decrypt credentials. You'll go into the shared folder, and create the master.key file and then add it to the list of files to symlink every deploy. That should be all you need for that since the credentials.yml.enc is already stored in your git repo.
Hey Glory!
Sounds like your server can't authenticate with your git repo. There are two options for this.
- You can add SSH keys on your server. Take the public key from the server and add it as a deploy key on your git repo.
- Let Capistrano forward your development machine's ssh key to the server and use it to clone your git repo.
I usually use #2.
They outline a bunch of details of this here in the Capistrano docs: https://capistranorb.com/documentation/getting-started/authentication-and-authorisation/
Posted in How to monitor account progress?
This would be a good little episode. I'll add it to my list.
Basically when a user takes an action, you just want to store that on their account so you can check and see if it's done and then you can display the progress bar.