FAQ Database Discussion Community


How to create a rails button with an icon and text?

ruby-on-rails,form-helpers
How would you create this button using a rail helper? <button type="submit" class="btn"> Create My Account <i class="fa"></i> </button> So far I have <%= f.submit "Create My Account", :class => "btn" %> ...

Model-independent Rails 4 file upload in dynamically loaded (nested) form field

ruby-on-rails,file-upload,nested-forms,nested-attributes,form-helpers
I'm looking for a way for simple image upload onto the file system so that the image is not stored in the database. I understand this step is rather easy, just using a file_input tag, however I have problems making it happen because of how my form is built. I...

Form Tag Helpers Cannot Process '-' in Rails 4

ruby-on-rails,validation,attributes,form-helpers,parsley
I am trying to use Parsley for Rails 4 with Form Tag Helpers. As said in the documentation "Options" provide a way for custom attributes; However, Parsley uses the notation "data-parsley". Rails cannot interpret the "-" and application brings out an error. Is there a workaround? Thanks,...

Only show country subset text in bootstrap formhelpers country picker

javascript,jquery,css,twitter-bootstrap,form-helpers
I am using Bootstrap FormHelpers country picker and I have the following init code: <div class="bfh-selectbox bfh-languages pull-right" data-language="es_ES" data-available="gl_ES,ca_ES,eu_ES,es_ES" data-flags="false" data-blank="false"></div> This code generate this output: <div class="bfh-selectbox bfh-languages pull-right" data-language="es_es" data-available="gl_ES,ca_ES,eu_ES,es_ES" data-flags="false" data-blank="false"> <input type="hidden" name="" value="es_es"> <a class="bfh-selectbox-toggle...

Rails 4: Save Checkbox Results to Serialized Array

ruby-on-rails,ruby,ruby-on-rails-4,checkbox,form-helpers
I have a Campaign model with a channel column. This channel will store a serialized array of chosen results via checkboxes. Here's the model.. app/models/campaign.rb class Campaign < ActiveRecord::Base serialize :channels, Array end app/controllers/compaigns_controller.rb class CampaignsController < ApplicationController def index @campaigns = Campaign.all.order("created_at DESC") end def new @campaign = Campaign.new...

Rails selector which has options a set of numbers

ruby-on-rails,form-helpers
I want to make a form in which the user can select a number between 1 and 30. I am trying to do something like this: <%= f.select("@currency.neural_network", "prediction_days", [1..30]) %> However, I am getting the below error. Failure/Error: click_link 'Show' ActionView::Template::Error: undefined method `merge' for [1..30]:Array The code for...