How can you prepopulate a Reform form object with variables from the query string?
I understand how to call prepopulate!
but how do I access a variable on the URL from within the Reform contract?
For example:
/example/new?lang=en
property :language, virtual: true, prepopulator: ->(*) { ??? }
To follow the docs on Trailblazer GitHub:
class AlbumsController
def new
@form = AlbumForm.new(Album.new)
end
should be:
class AlbumsController
def new
@form = AlbumForm.new(Album.new(language: params[:lang]))
end