News Articles ruby-on-rails

422 unprocessable entity, when trying to send user sign up details to rails api

I’m trying to send JSON from react front end to the rails API with devise to sign up a new user. I have already successfully added a new user with insomnia by a HTTP post request with JSON and in this format below, receiving back a token { "user": { "id": 7, "email": "[email protected]", "username": […]

How to seperate React application from Ruby on Rails created with webpack configuration?

I found an open source Ruby on Rails project that is created with command rails new myapp –webpack=react but I am only interested in the React part. How can I seperate it from the rest and enable it to run on its own? The link to repo: https://github.com/vigetlabs/storyboard For what I have done so far; […]

Uncaught TypeError: Cannot read property ‘childNodes’ of null in Nested Attributes in Rails

A Model UserType has_many UserRating and UserRating has_many RiskAndOutcome. UserRating and Risk outcome is created along with UserType. class UserType has_many :user_ratings nested_attributes :user_ratings end class UserRating has_many :risk_and_outcomes nested_attributes :risk_and_outcomes end in the below table, f refers to user_type <table class="table table-search table-striped table-responsive user_rating_table" id="condensedTable"> <thead> <tr> <th>From</th> <th>To</th> <th>Outcome</th> <th class="finaliser_hr hide">Authorised […]

Nesting JSON data to send to API

I have a rails API which i’m trying to send JSON data to from a react front end in this format: { "user" : { "email": "[email protected]" "password": "dave123" "password_confirmation": "dave123" "subject": "david" "teacher": "student" "username": "mikey" } } it’s obviously nested inside "user" but my code currently just sends it without the user wrapped […]

Ruby on Rails Form Add an "Other" Option with Text Box to Select Dropdown

I have a ruby form that includes the following code <%= form.label(:emitter_type, class: "form-label") %> <%= form.select(:emitter_type, BoilerPlant.emitter_type , include_blank: true) %> <% if boiler_plant.emitter_type != "Other" %> <div id="emitter_other", style="display:none;"> <% else %> <div id="emitter_other"> <% end %> <%= form.label(:emitter_type_other, class: "form-label") %> <%= form.text_field(:emitter_type_other , autocomplete: "off", autocapitalize: "on", class: "form-input") %> </div> […]

How to display icon from svg sprite in pseudo element with ruby on rails

I want to create a menu like this Home > where the right arrow is an icon in an svg sprite. I would like to place the > as a psuedo element in the css selector so that i can make any menu have the right arrow just by adding the css selector .menu-arrow. I […]

Partial render not working on ajax call rails

I am trying to reload a partial with a page (not the whole) page when I click on a button. When i click on button reset_me, it should reload the partial. Even though the partial is being called, the javascript inside js.haml is not executed. routes post :reset_filter, defaults: { format: ‘js’ } controller action […]

Material UI select not dynamically populating options

I have the below functional react component that is not working as expected with regards to populating the options when the select dropdown is clicked. This component’s productData prop is data that is returning from the app’s API. I have already confirmed that data is actually being returned, if I hard code the values by […]

How to include canvas-toBlob and Blob Polyfill JavaScript packages to rails

Hi Guys quick rails question, I want to use a package called canvas-toBlob because I need to make canvas.toBlob() available in browsers that don’t’ supported it, so I installed it via yarn. The documentation of the package suggests using an implementation (Blob) to support Blob in several browsers, this implementation is not present in npm […]

Merging 2 3d files into one

I am trying to merge 2 3d files into one. Any two 3d files .vox / .obj / .glb. For my endeavor I can use js/ruby/golang(preferably). What I want is something like this package over here. Sadly I can’t find anything that I find useful. Is it even possible? Node: I have no knowledge of […]

Is there a way to convert JSON data received from Google Slides API back into the original presentation?

I am working on a functionality where I ask the user to input the ID of Google Slide. I then call Google Slides API in my Ruby on Rails backend from where I return to the React frontend a response with the JSON data. For now, I have been successful in getting the JSON data […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.