I have a I'm trying this in my profile controller: and this and in my App Assistant: I can not find the UPDATE: This is the relevant code in my 2 update: I get this error: profile_type = params [: user] [: profile] [: Type] .consta Net If [ "artist", "listener"]. Include? Profile_type @profile = current_user.profile = profile_type.new current_user.save! Else flash [: warning] = "profile type is not supported" and end Update: This is not really necessary, useful code might be, but it is not necessary to solve the above problem. user model that is
is_one: profile And in the
profile model there is a
type column for inheriting a table. I want to set up a
type to sign up a user, and I'm having trouble doing this.
def make @ profile = profile.find (param [: id]) type = param [: user] [: Profile_Aditors] [: type] if type & amp; Amp; ["Artist", "Listener"] Include (type) @ profile.update_editrid (: type, type) end of end
user new view in my form: < Pre>
& lt;% = form_for (setup_user (@user)) f | F | & Gt%; ... & lt;% = f.fields_for: profiling | T | & Gt%; & Lt; Div class = "field" & gt; & Lt;% = t.label: type, "Are you an artist or listener?" % & Gt; & Lt; Br / & gt; & Lt; P & gt; Artist: & lt;% = t.radio_button: type, "artist"%> & Lt; / P & gt; & Lt; P & gt; Audience: & lt;% = t.radio_button: type, "listener"%> & Lt; / P & gt; & Lt; / Div & gt; & Lt;% end% & gt; ... & lt;% end% & gt;
def setup_user (user) user.tap do | U | U.build_profile if u.profile.nil? End end
type set when the user is created. This is still the default for
zero why is this and how can I complete it? I appreciate a code example.
user model:
is_one: acceptable for profile_cent_data_profile: Profile_Next: build_profile
Warning: Can not consider protected attributes: type
Comments
Post a Comment