stackoverflow.com Archives - 25 January 2013, Friday

  • on rails events and decoupling

    stackoverflow.com 19 Jan '13, 6am

    I'm new to Rails and have been trying to figure out how to structure my applications. Coming from a Symfony2 background I am used to an event driven approach. Events allow for strong decoupling of components. Does Rails have framework events/hooks? What is the Rails approach to decoup...

  • bash - How to stop Ruby WEBrick app from Terminal in Xubuntu

    stackoverflow.com 05 Jan '13, 12pm

    I started learn Ruby. I tried to work with WEBrick server. After ruby index.rb command server starts. And how to stop it? I tried Ctrl+c, Ctrl+X and other. It still working. Then I pushed Ctrl+Z. Bash said: [1]+ Stopped ruby index.rb. But process is still working, and using my port, t...

  • mysql - SQL Query Ruby On

    stackoverflow.com 01 Jan '13, 6pm

    Hi I have two models team and fixture, the fixture model has two columns home_team_id and away_team which contain the foreign key of team primary key. I am trying to do a select query where I can get the team name through using the home_team_id and away_team_id in the fixture table. c...

  • on Rails 3: Sign-In With devise and cancan

    stackoverflow.com 01 Jan '13, 1pm

    rspec test fail - user sign out - Ruby on Rails 3 Tutorial book Chap 9 Ruby on rails mysql problem CanCan, Devise, Rails and Backbone.js, issue with :update CanCan + Devise for the devise user model How to add authentication before filter to a rails 3 apps with devise for user sign up...

  • on rails - get jquery to submit one of two forms

    stackoverflow.com 31 Dec '12, 5pm

    i am trying to get jquery to submit one of two forms when a submit_tag is clicked. I am basing my conditions on the presence of text. so whichever form has text in then submit that one. My forms looks like this <div class="container margin50"> <div class="row"> <div class="span6 offse...

  • on rails - Use jquery to check which form is completed and then submit using one button

    stackoverflow.com 31 Dec '12, 1pm

    I have two forms that make a separate requests to different apis. What i am trying to achieve is to maybe have jquery check which form has been completed and then submit the relevant form. Each request goes through its specific controller. the forms are like this <div class="container...

  • on rails 3 - timesheet in rails3

    stackoverflow.com 28 Dec '12, 12pm

    <tr id="row<%= index %>" valign="top" class ='time_stamp'> <%= hidden_field_tag "timesheet[timesheet_line_items_attributes][#{index}][id]",timesheet_line_item.id%> <%= hidden_field_tag "timesheet[timesheet_line_items_attributes][#{index}][_destroy]"%> <td valign="top" style='padding-l...

  • Create a has_many association where a condition applies to the primary table in ruby on

    stackoverflow.com 26 Dec '12, 5pm

    Soliciting Rails Association Feedback + Questions from a Noob How can I create, associate, and de-associate related records in Rails ActiveRecord with accepts_nested_attributes_for Rails: How do I define an association extension in a module that gets included in my AR model? How do yo...

  • Applicability of ruby on rails for a video heavy application?

    stackoverflow.com 26 Dec '12, 1pm

    I intend to develop a web application that will have most of the features like facebook and youtube have, for instance - a user can share videos with their friends, people can comment on the videos and upvote or downvote each others comments, form groups etc. etc. I would like to know...

  • Adding html tag in ruby on rails controller

    stackoverflow.com 26 Dec '12, 10am

    How do I add html tag in ruby on rails controller? I want to add this statement include a_tag in ruby on rails controller. "Go straight to <a href='http://www.sportskaki.com'>www.sportskaki.com</a> to reply. game_message.message = " Would you like to play " + @game.sport.sport_name.to...

  • on rails - How to "soft delete" user with Devise

    stackoverflow.com 26 Dec '12, 2am

    I could advise overriding destroy method on your User model to simply do update_attribute(:deleted_at, Time.current) (instead of actually destroying), but this deviation from standard API could become burdensome in the future, so here's how to modify the controller. Devise has a bunch...

  • on Rails Console with Associations

    stackoverflow.com 26 Dec '12, 12am

    Rails ActiveRecord associations inconsistently updated has_many, belongs_to association where has_many associated model has two alias fk in belongs_to associated_model Rails Associations (belongs_to, has_many) can't save 2 ids in table with a create method (user, post, comment) How to...

  • sql - Affect to a "label" the value of the selected item of a combobox in ruby on

    stackoverflow.com 25 Dec '12, 12pm

    As per my understanding on changing or on selecting you have to set label on UI. To achieve this you have to use javascript, set id for select tag suppose id is country and set some label id suppose 'country_label' $("#country").change(function(){ var optionText = $("#country option:s...

  • jquery - How to pass updating javascript variable into form to controller in Ruby on

    stackoverflow.com 22 Dec '12, 3am

    I have the following javascript: <script type="text/javascript" charset="utf-8"> $(function() { $( "#slider-range" ).slider({ range: true, min: 200, max: 2000, values: [ 800, 1200 ], slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); }...

  • visual studio 2012 - Python vs IronPython for BitCoin Development

    stackoverflow.com 20 Dec '12, 1am

    Without knowing how your existing code is built, or how you intend the new version to work, it's hard to answer specifically, but I can give some generalities. IronPython limitations/issues, in decreasing order of importance: * No third-party C extension modules. If you depend on any,...

  • Rake commands aborted

    stackoverflow.com 16 Dec '12, 7pm

    I'm pretty sure I should be posting this here, but feel free to correct me if this belongs on something like Superuser. Trying to setup this Ruby/Javascript app https://github.com/jamesu/tubehub - on my freshly formatted Linode. Running: Ubuntu v10.04 LTS, Ruby v1.8.8dev, Rails v3.2.9...

  • on rails spree commerce

    stackoverflow.com 16 Dec '12, 6pm

    When I install spree in a new rails project I get following error ←[31mgit://github.com/spree/spree_auth_devise.git (at 1-2-stable) is not checked out. Please run `bundle install`←[0m* *Would you like to install the default gateways? (yes/no) [yes] yes Would you like to install the de...

  • 'ruby-on-rails' Top Users

    stackoverflow.com 15 Dec '12, 6pm

    Only non community-wiki questions and answers are included in these totals (updated daily)

  • on rails - Having lowercase method names with mixed case column names

    stackoverflow.com 13 Dec '12, 10am

    I need to connect to a legacy SQL Server 2000 database using their own conventions and specially CamelCase columns and Tables. For tables it seems fine, Rails is asking it with lowercase and the database find it nicely. The issue is with the columns because Rails fetch their name with...

  • mongodb - Ruby on Rails based website and app

    stackoverflow.com 01 Dec '12, 6am

    I have started coding during my free time for over a year now. I had a social community idea which will be location based which basically deals with locations and nearby trending places. I did some 10 minute video about scaffolding and have been totally smitten by Ruby on Rails. I rea...

  • Using WS-Security tools to secure web applications created by Ruby on rails framework

    stackoverflow.com 25 Nov '12, 5am

    Is it possible for a web application developed using ruby on rails framework to intercept all calls to it with a third party security tool. Any call to this web application goes to security tool instead of web application itself and then security tool can redirect it to web applicatio...

  • How to override gem controller action Ruby on

    stackoverflow.com 24 Nov '12, 11pm

    I have Devise gem for user authentication. Basically, I want to override registrations_controller.rb in Devise gem locally. The code in gem: class Devise::RegistrationsController < DeviseController ... def update ...(need to override) end end I want to redirect user to other page if p...

  • osx - Writing a ruby script that parses xml to distribute to non-coders

    stackoverflow.com 24 Nov '12, 10pm

    I am creating an open source workflow that will tie an OS X application Devonthink to Zotero in the following manner: An AppleScript called inside the OS X app devonthink will run a Ruby script via the shell This Ruby script (which I find much faster, better for these sorts of things ...

  • on rails - Finding multiple time slots with Squeel gem

    stackoverflow.com 23 Nov '12, 7am

    Migrating from MetaWhere to Squeel and away from using symbols Squeel to execute outer join on Rails 'on' option to joins in squeel Using NOW() in a select with Squeel Squeel query comparing 2 variables Rails ActiveRecord::StatementInvalid: PG::Error: ERROR: missing FROM-clause entry ...

  • auto update database attribute after clicking submit on a form

    stackoverflow.com 18 Nov '12, 6pm

    I am using simple_form in rails to create certain events. To create a new event, you are required to login as a user. The form will ask the user to enter the event name, start date, and end date. When the user clicks the submit button, I want the form to automatically update the attri...

  • sql - How to group by a range of values in ActiveRecord (ruby on

    stackoverflow.com 17 Nov '12, 8am

    I have an ActiveRecord model that has two columns I want to group and sum by (both are integers). The issue I can't seem to solve is how to sum the first column as a group of the second column, with the second column being grouped by a range. I know that I can do Model.sum(:first_colu...

  • apache - Ruby on Rails Server options

    stackoverflow.com 16 Nov '12, 1pm

    The word "deployment" can have two meanings depending on the context. You are also confusing the roles of Apache/Nginx with the roles of other components. Apache vs Nginx They're both web servers. They can serve static files but - with the right modules - can also serve dynamic web ap...

  • 3-2-stable on Ruby 2.0, Psych error on bundle

    stackoverflow.com 10 Nov '12, 3pm

    > bundle Updating git://github.com/rails/rails.git Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks! .rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): mapping valu...

  • on Rails has many relation table

    stackoverflow.com 04 Nov '12, 1pm

    I have a table rb wich has many interfaces , then each interface has many interface_graph_data . Now my rb interface has_many relation seems to work fine, my only problem is the interface interface_graph_data relation. Here are my models. class Rb < ActiveRecord::Base validates_presen...

  • javascript - Ruby on Rails - how require is executed in application.js

    stackoverflow.com 04 Nov '12, 11am

    I am reading a book for "Ruby on Rails". In the "application.js", we are including other JavaScript libraries in the following way and more specific - jQuery UI: //= require jquery //= require jquery_ujs //= require jquery-ui As this is ordinary JavaScript file (not ruby extensions he...