I found this very helpful snippet in this thread on the devise google group initializers/some_initializer.rb: Warden::Strategies.add(:custom_strategy_name) do def valid? # code here to check whether to try and authenticate using this strategy; return true/false end def authenticate! #...
I have some question ... example: a user will buy something for his USD Check his USD Balance Deduct the USD from his account Make an Order -> order queue user becomes his item and the other one becomes his USD Lets say, the users makes 5 requests in the same second (very fast). So it...
I'm switching from PHP to Ruby on Rails and I'm loving it, the only thing is I'm so used to Twitter Bootstrap for most of my designs and now I feel crippled without it, I followed some tutorials like adding bootstrap-sass and what not to my Gemfile , but I still appear to be missing i...
You're in luck, friend. My first Rails project (7 years ago) was against a horribly set up SQL Server database. Per the above, you need to set up your database.yml appropriately. But for an existing database, obviously it is unlikely that the table and column names conform to the Rail...
I've just created a new amazon Linux instance and installed ruby 1.9.3 and rails 3.2.8. Upon creating a new project I immediately receive failures due to sqlite3. The error is: [root@xxxxx fun]# rails server /usr/local/share/gems/gems/sqlite3-1.3.6/lib/sqlite3.rb:6:in `require': canno...
I'm kind of stuck with this problem. I am currently trying to host a Rails3/Ruby1.9.3 App on a shared host(Site5). They only provide 1.8.7 for Ruby. So, I tried installing RVM so I can make use of Ruby 1.9.3. After installing RVM successfully, running 'bundle install', I encountered t...
I'm creating an e-mail notification in a .text.haml document. How does one denote a blank line? = @variable.name + " , you have a new update." = = = "There has been new activity." In the above example I would like the two lines that have just the haml '=' on them to be blank lines but...
We're already using the NewRelic service to monitor RoR applications. We have some customers whose security policies will not allow us to use external services to monitor their internal applications. Could anybody recommend some open-source (non commercial) monitoring tools which coul...
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...
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...
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...
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...
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...
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...
<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...
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...
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...
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...
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...
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...
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...
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 ] ); }...
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,...
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...
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...
Only non community-wiki questions and answers are included in these totals (updated daily)
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...
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...
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...
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...