Tag: forms

Undefined method `to_hash' while saving with reform gem

I got a problem. I’m using reform gem in my Rails application with some complex forms. Unfortunately I stuck while creating a form. That’s my code: class Order::Form < Reform::Form include Coercion include Composition include Reform::Form::ActiveRecord property :subscription, on: :order property :due_date, type: Date, on: :order property :start_fee, numericality: true, on: :order collection :products, populate_if_empty: […]

Ruby recaptcha with multiple forms?

We use the gem ruby-recaptcha. It was easy to install and implement in almost every situation that needed it following the docs: https://bitbucket.org/mml/ruby-recaptcha/wiki/Home I’ve been stuck on one particular case and thought I’d ask if anyone else had solved this problem before I switched gems or tried hacking this one. On cases where there are […]

Passing a parent_id via a form using the Ancestry gem

I am new to rails, I am using the ancestry gem and I am having trouble passing the parent_id via a form. <% title “Messages” %> <% for message in @messages %> <div class=”message”> <div class=”created_at”><%= message.created_at.strftime(“%B %d, %Y”) %></div> <div class=”content”> <%= message.content %> </div> <div class=”actions”> <%= link_to “Reply”, new_message_path(:parent_id => message) %> […]

simple forms website on RoR- let the user go to a customized link which he can share that shows what he just inputted

I’m a pretty big RoR novice but I’ve had a lot of problems with finding out even where to begin. I’m looking for any tutorials or examples of apps that lets a user fill out a simple form in ruby, takes that information, redirects to another page, and posts the information. The user would be […]

Ruby on Rails autocomplete gem undefined local variable

I’m trying to use rails3-jquery–autocomplete gem by CrowdInteractive: https://github.com/crowdint/rails3-jquery-autocomplete/blob/master/README.md I get this error however: undefined local variable or method autocomplete_food_long_desc_foods_path’ for #<#<Class:0xa17cf00>:0xa5ac724> I know this question has been asked before, but I still can’t seem to figure out what I’m doing wrong. I followed all the instructions in the README, and here is my code: […]

Rails remote form works for one model, does not for another

I have a few models in my application. For all of them there is no problem to send form with :remote => true. But there is a problem with one called Banners. It is placed in separated gem, but when I moved its model and controller to application, it still doesn’t work. This code has […]

Rails nested_form gem updates wrong parent data

I have the following in one of my forms. With this code I can dynamically add divisions, sub_divisions and sub_sub_divisions on the page. The problem is the sub_sub_divisions I add are saved to the first sub_division even though they are correctly displayed on other sub_divisions on the view. I don’t know what is happening between […]

Rails One-To-Many Nested Form – Error using controller show action to view posted form?

I’m trying to create a posting form to post a url & some text. The nested form submits without an error but I can’t display the subsequent content of that form in my show action controller. Post Model class Post < ActiveRecord::Base has_many :texts has_many :urls accepts_nested_attributes_for :texts, :urls end Text Model class Text < […]

Rails One-To-Many Nested Form. No Image displayed in browser when using show action controller? (Paperclip Gem used)

I’m trying to create a posting form to post a url & image. The nested form submits without an error but I can’t display the subsequent image of that form in the browser. I have used the paperclip gem for the image upload. Post Model class Post < ActiveRecord::Base has_many :urls has_many :photos accepts_nested_attributes_for :urls, […]

routing error for nested resource with ledermann-rails-settings

I’m trying to allow users to update preferences from default settings with a form for ledermann-rails-settings. I got the form built based on this answer, but when I try to submit the form to update settings, I get a routing error that I think is related to nested resources, but I’m new to RoR so […]

Ruby is the best programming language in the world - Ruby on Rails.