Home >

ruby on rails 4

  • Uploading multiple images in Rials using paperclipMay 6

    I am trying to upload multiple images for a current user using paperclip and for some reason I cannot upload any image at all. Here is my nested form: = f.simple_fields_for :pictures do |p| - if p.object.new_record? %tr %td= p.input :photo, as: :file

  • Before validation on nested modelJanuary 9

    I have a nested model items and I am trying to multiply two columns together cost and quantity to set the last column price. I need to set the column price before the form is saved and i need to also validate the model. The before_validation call bac

  • Nested from with accepts_nested_attributes_for and has_many polymorphicJanuary 7

    I just want the user to be able to create a recipe with tags. Here are my models: class Tagging < ActiveRecord::Base belongs_to :tag belongs_to :tagging, :polymorphic => true end class Tag < ActiveRecord::Base has_many :taggings has_many :recipes

  • Uploading multiple files using nested attributes and carrierwave getmDecember 5

    I am doing multiple file upload using nested fields and Carrierwave gem. Here is my set up: <%= form_for @medical_situation, url: create_medical_situation_patients_path(patient:@patient) do |f| %> <%= f.fields_for :lab_tests do |lab_test| %> &

  • undefined method `avatar' for # User::ActiveRecord_Relation:0x007fc328248ef0February 17

    I'm trying to display the data for a user searched by their first or last name. I'm able to display all data returned for a user (e.g. if user is searched by first name, I can pull all other fields/data associated with the searched user, such as city

  • Search a model's reference's/foreign_key's attribute (in rails using SQLite3)February 17

    I am trying to perform a search function on a table # my controller EntriesController.rb def index @entries = Entry.all @entries = Entry.search(params[:search]) @entry = current_user.entries.build if logged_in? end I was able to implement a search ba

  • pdfkit not working using header-html and footer-htmlFebruary 17

    I am trying to generate a pdf with header and footer using pdfkit. Without specifying header-html and footer-html it is working. But when I try to add: :header_html => pdf_header_url :footer_html => pdf_footer_url to the pdfkit configuration options

  • Using devise with nested form on sign_upFebruary 17

    The form doesn't show the Pessoa's field, what's wrong? <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> <%= devise_error_messages! %> <h4>Usuário</h4> <%= f.email_field :email, autofocu

  • rails 4.2.5 has_and_belongs_to_many relationship how to make it workFebruary 17

    I'm new to rails, and am doing a basic rails app.. articles ..that has users, articles and tags.So the problem is that I cant make the HABTM relationship to work.. pls help.I'm using rails 4.2.5 and ruby 2.1.5p273 and mysql2 gem. So here is my User m

  • Rails 4 AJAX delete link in HAML

    Rails 4 AJAX delete link in HAMLFebruary 17

    Given the following: What is the HAML magic on making such a thing work? I found this stackoverflow question but of course it's an ERB file. And, my HAML skills are SORELY lacking (it's an inherited system). I also don't have any other examples in th

  • Search results not printing?February 17

    I've built a search bar into my application.html.erb header that allows my visitors to search "Users" on my site, and upon clicking the 'submit' button to show search results, found results don't seem to print on my page (it's merely blank). I'v

  • Making Rails generators respect engine namespacingFebruary 17

    I'm trying to use a third-party gem (blacklight) to generate parts of a Rails engine. However, the gem's generators all assume they're running in an application, not an engine, so they keep trying to access or create files that aren't in the namespac

  • How to access a new spree modelFebruary 17

    I am new to spree, I have created a new spree model module Spree class VerificationDocument < ActiveRecord::Base end end When I am trying to access the model from console it's showing an error NameError: uninitialized constant Spree::VerificationDocu

  • Ruby on Rails 4 haml view javascript to access instance variableFebruary 17

    I"m new to Ruby on Rails and currently learning how to use Javascript in HAML views to access instance variables. Could somebody provide guidance how to to this ? My scenario is as follows: On view render controller has instance variable (hash) @pack

  • Acts_As_Votable_Cached is automatically liking new posts Rails 4February 17

    When I try to list users with the highest votes in descending order. The `cached_votes_total => :desc method automatically adds one like vote to the post or that's what I'm seeing every time that I create one. index.html.erb <td><h2><%=

  • Rails, Nested Resource, Update ActionFebruary 17

    HELP! I'm trying to have a simple button to update for each Comment through a submit form. Here is my View code: <% @comments.each do |comment| %> <%= form_for comment, url: article_comment_path(comment.article, comment), method: :patch do |f| %&

  • Adding font-awesome icon inside a input field when using simple-form

    Adding font-awesome icon inside a input field when using simple-formFebruary 17

    I looked and used the solution for placing the font-awesome icons inside an input field box as outlined here. StackOverflow answer HTML <input name="txtName" id="txtName"> <span class="fa fa-user errspan"></spa

  • No exception received from Rake task with Airbrake rails integrationFebruary 17

    Since version 5 Airbrake and its Rails integration offers automatic exception reporting in any Rake tasks. However I've not received rake exception on my errbit server. I've made the following test : Create a fresh rails 4.1 application. Include airb

  • Uninitialized constant error pertaining to Rails' namespacesFebruary 17

    I posted this question before, but changed some variable names and realized my mistake too late, so this code is unaltered in any way. Error: Routing Error uninitialized constant Firefighters Rails.root: /Users/Vladdy/Dropbox/dev/firestaff Here's the

  • undefined local variable or method `destroy' for CommentsController:Class in my destroy comment methodFebruary 17

    I've added a comment feature in my app and so far everything's working fine until this error came up. What I did is that I added a delete comment feature. Everything shows normal when I fire up the server, but the problem comes in after I click the '

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.309 s.