ApplicationRecord literal getting inserted into database as value

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ApplicationRecord literal getting inserted into database as value

fugee ohu
I'm not calling from a main app page I'm calling and rendering the follow form from inside a mounted engine The follow model belongs to polymorphic association followable so in this case followable_type should be Mnt but it's appearing as ApplicationRecord

SQL (0.7ms)  INSERT INTO `follows` (`followable_id`, `followable_type`, `follower_id`, `follower_type`, `created_at`, `updated_at`) VALUES (2, 'ApplicationRecord', 5, 'User', '2018-03-08 05:19:28', '2018-03-08 05:19:28')

This is the form that was submitted:
 <%= form_tag follow_path(mnt_id:, method: :post, remote: true do %>
  <% button_tag class: 'btn btn-primary ' do %>
   <%= 'Follow' %>
  <% end %>

This is the controller:
  def create
    if params[:user_id]
      @user = User.find(params[:user_id])
    elsif params[:mnt_id]
      @mnt = Mnt.find(params[:mnt_id])

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit
For more options, visit