...commit Save movie Now change your MoviesController#create method so it prints out the params that Rails sees. For this we comment out the code that was creating the movie...

...and render the params object: def create # @movie = Movie.new # @movie.attributes = params[:movie] # if @movie.save # redirect_to @movie # else # render 'new' # end render plain: params.inspect end Note that #inspect returns a...

...api.random.org/json-rpc/4/invoke', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ jsonrpc: '4.0', method: 'generateIntegers', params: { apiKey: ..., // other params described in the API documentation such as "n", "min" and "max" } })

makandra Curriculum

Understand how nested attributes appear in the params. See how the Rails form helpers encode the names of nested inputs. Understand how the record and all of its nested...

makandra Curriculum

...requests and responses do you see? Update an existing card. Find your form data ("params") in the the relevant request entry in the Network tab. Find out how to throttle...

...Continue by reading and understanding these resources: What problem is being addressed by strong parameters? (now part of Rails) How does Rails protect you against injecting unwanted HTML tags?

...get '/help', to: 'help#download' class HelpController < ApplicationController def download pdf_path = Rails.root + "/documents/" + params[:doc] + ".pdf" send_file pdf_path end end Is it a good idea to build...

Best results in other decks

github.com

The new params.expect method in Rails 8 improves parameter filtering, addressing issues with malformed input and enhancing security. It provides a cleaner, more explicit way to enforce the structure and...

...types of incoming parameters. What changed Replaces require and permit: Combines both methods for concise parameter validation. Explicit Array Handling: Requires double array syntax to define arrays of hashes, improving...

...If different, it would redirect users to the generated/expected path. expected_path = url_for(params.to_unsafe_h) # ❌ this is not safe! if expected_path != request.original_fullpath redirect_to expected_path...

...an Open Redirect vulnerability. It's as simple as passing a host=evil.tld URL parameter. Rails would see url_for(..., host: "evil.tld") and happily generate a URL to that foreign...

Search in all decks