Stack Overflow

A language-independent collaboratively edited question and answer site for programmers.

  • javascript - Rails - execute an ajax call via select dropdown menu

    stackoverflow.com 22 Jun '17, 7am

    I have a view that contains a select tag, it is not part of a form just a stand alone drop down menu. On clicking one of the options I want to execute an ajax call This is the select tag <%= select_tag 'application_stage', options_for_select(application.job.hiring_procedure.hiring_pro...

    1. via @Cointelegraph cointelegraph.com 22 Jun '17, 1pm
  • javascript - Why escape_javascript before rendering a partial?

    stackoverflow.com 18 Jun '17, 9pm

    If you look at the source here , it will be much clearer. This function accomplishes the following two things: It substitutes the characters in the input string with the ones defined in JS_ESCAPE_MAP The purpose of this is to make sure that the javascript code is serialized correctly ...

  • on rails - How do I serialize an array field into MySQL?

    stackoverflow.com 29 May '17, 10am

    I have request_type as a array field in my database. For this I did following migration def change change_column :users, :request_type, :string, array: true, default: '{}' end which I got from this question . I also added serialize into the model file. class User < ActiveRecord::Base ...

  • In mongodb,How to use ruby on rails "migration" tools

    stackoverflow.com 03 May '17, 7pm

    In ruby on rails normally use SQLite as a database.so a special property of rails called migration are work.but when we use "mongodb" as a database in rails.I see there have no migrate folder in the db directory. Is there any way to use this migration property in rails when use mongodb.

  • on Rails - No route matches [POST] "/setor/update"

    stackoverflow.com 14 May '17, 12am

    i'm new to ruby on rails and I keep getting this error when trying to update an object. here's my controller: class SetorController < ApplicationController def index @setor = Setor.all end def new end def show @setor = Setor.find(params[:id]) end def create @setor = Setor.new(setor_pa...

  • AWS Elastic beanstalk Ruby App not loading Production ENV

    stackoverflow.com 01 May '17, 4pm

    My Ruby on Rails app on AWS Elastic beanstalk is for loading the staging environment, even though it has been configured as production. BUNDLE_PATH: vendor/bundle RAILS_ENV: production RAILS_SKIP_ASSET_COMPILATION: false RAILS_SKIP_MIGRATIONS: false BUNDLE_WITHOUT: test:development RA...

  • on rails - Order query by number of times one model has another

    stackoverflow.com 25 Mar '17, 6am

    I have the following structure: User model: id, .. Event model: id, .. UserMapEvent model: user_id, event_id For example the UserMapEvent table might have the following records: User_id - Event_id 1 - 1 1 - 2 3 - 1 4 - 1 I'm using this structure to save when a user likes an event. Now...

  • Common Ruby Idioms

    stackoverflow.com 22 Apr '17, 12am

    The magic if clause that lets the same file serve as a library or a script: if __FILE__ == $0 # this library may be run as a standalone script end Packing and unpacking arrays: # put the first two words in a and b and the rest in arr a,b,*arr = *%w{a dog was following me, but then he ...