Rafael Soares

Joined

4,020 Experience
39 Lessons Completed
0 Questions Solved

Activity

Posted in Create form object with has_many attribute

Hi guys, the problem is that both of these libraries need ActiveRecord to work with, and I'm using only ActiveModel

class Lesson
   include ActiveModel::Model
   attr_accessor :students

end

class Student
  attr_accessor :name
end

I have to make a nested form for this. The activemodel-associations gets close, but it still needs an ActiveRecord object in one end of the relation to work

Posted in Create form object with has_many attribute

Hi all,

I often use form objects in some places in my application. But what I need now is something a little more complex.

When I create them, it's always an ActiveModel object with simple string attributes. But what I need now is for this object to have nested objects in them.

Ex: I have a ClassroomForm object, which has simple attributes such as name and teacher_id. But this Classroom object can have many student object, which has fields such as name and status.

What is the best way to do it using ActiveModel? Is the solution to create two form objects, ClassroomForm and StudentsForm, and then in ClassroomForm declare a attr_accessor :students ? But then how can I add new students in the form (using nested attributes)?

I did some searching in google and surprisingly dind't find anything related to it

Posted in Upload in webview

Hi Chris, thanks for the reply,

It does have permission to the camera roll. Actually I just did a test with a very simple snippet of code. I've put the following in a html file in the public folder.

<html> <body> <input type="file" name="test" /> </body> </html>

But it still doens't open the dialog box. Do you have any experience with this?

Posted in Upload in webview

I have a Rails web application, and I hired someone to develop an android and iphone app for it, which is just a webview opening the website.

In the web app, the user can upload an avatar picture. But uploading is not working from the app, it just doesn't open the dialog box to choose the file.

Anybody had this issue before and knows if there is a way I can solve this issue from the rails side?

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.