Search Results

Search found 7350 results on 294 pages for 'rspec rails'.

Page 36/294 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • Accessing PostGIS spatial data from Rails

    - by Lakitu
    I need to use an existing PostGIS database from my Rails application. So far I am able to access the DB just fine, GeoRuby nicely converts the 'geom' column into a Point object. What I am looking for is an easy way to execute ActiveRecord-like queries on those tables, e.g. Poi.find_within_radius(...) or similar spatial queries like distance calculations et. al. I tried several combinations of geokit, accompanying rails plugins but I'm quite sure there must be something better out there in the ruby/rails universe. Any hints?

    Read the article

  • cheap way to scale a rails application

    - by VP
    I have an application, that is becoming big, but until now, its not giving me a good revenue. That means, short money to re-invest on that. In this scenario, i found a way to make a "cheap distributed rails" deployment. I've got 4 VPS. All of them are in the same physical server. I added a load balance server running HAproxy in one dedicated VPS. There i pointed my virtual ip address where my domain name is associated. Behind this HAproxy i have more two VPS running my rails APP, passenger and memcache. Both apps servers are looking to the same database server, my 4th VPS. So with $44/month, i mounted a distributed environment. It won't be my final choice, but now, that the budget is short, is that a good way to deploy a rails application? Any pros or cons? It worth my $44/month?

    Read the article

  • OCIError (ruby on rails)

    - by swingfuture
    I am using rails freeze 1.2.3 to run a rails app. Because the app is on a remote machine, I used ssh tunnel (ssh -l -L) to show the app on my screen. When I ran it, it correctly prompted the login page, after I put in the info, I got this error: OCIError in ServiceController Error while trying to retrieve text for error ORA-12154 I have tried the same app on a different machine w/o using freeze (because that machine has rails version 1.2.3 while current one has 2.0.2). Is that where the error comes from? Thanks.

    Read the article

  • Rails plugin for generating dynamic / ajax crud interfaces compatible with Rails 3 beta?

    - by mikehansen
    Anyone know of some good gems or plugins to create dynamic / ajax crud interfaces for Rails 3 projects? I know active scaffold was popular before and it's been awhile since I have used it / any other gems similar to this (I usually just write it myself). I like the direction that the formtastic gem (http://github.com/justinfrench/formtastic) is headed and wonder what else people are combining with it. Also I like the generators approach that Ryan Bates uses and he appears to be making updates for Rails 3. Anything else I am missing here? (I am also open to gems not compatible with Rails 3 too I guess, I can always make a contribution and try to help them get to the next phase. ;)) PS - Really stackoverflow, only one hyperlink?? lame.

    Read the article

  • Reloading Rails Directories: Not Lib!

    - by yar
    I have checked out several questions on this, including all of those you see next to the question. Unfortunately, I'm not working with a plugin, and I don't want to work in lib. I have a directory called File.join(Rails.root, 'classes') and I'd like the classes in this directory to reload automatically in dev. In my environment.rb I have this line config.load_paths << File.join(Rails.root, 'classes') which works fine and blows up if the path isn't there. The reloading line in my development.rb also works fine require_dependency File.join(Rails.root, 'classes', 'blah.rb') which blows up if the file is not there (a good sign). However, the file doesn't reload. This all works if the file is in the root of lib and I use the require_dependency line, but my whole point is to get stuff out of lib as suggested here.

    Read the article

  • Preparing for Rails deployment

    - by Meltemi
    Getting ready to deploy a rails project on Mac OS X Leopard Server (such that it matters). Got a few questions for someone with Rails experience: where should directory containing the project go? inside the website's root folder or out? who should "own" that directory? www? root? something/someone else? hope to continue serving static pages via Apache... would like rails app to be served by mydomain/xxx/railsapp. is there a standard naming convention for 'xxx'? not expecting too much traffic to begin with...just like to keep things as simple as possible.

    Read the article

  • Rails 3 beta 1 - Nested layouts - LocalJumpError

    - by Art Shayderov
    Hi Nested layouts do not work in Rails 3. After I hit this I tried Rails Guides Example on a blank project (both ruby 1.9.1 and 1.8.7). LocalJumpError no block given on line <%= yield :stylesheets %. If you remove this line you will get the same error on the next yield statement. Could someone fix(patch) this? It's probably just a matter of calling block_given? in the right place. That would be great. Thanks Added on 4/3: Rails 3 beta 2 released. Problem fixed.

    Read the article

  • Stop Rails from unloading a module in development mode

    - by Gareth
    I have a module in my Rails app that lives in /lib module MyModule mattr_accessor :the_variable class << self def setup yield this end end end From my environments/#{RAILS_ENV}.rb file I can then set an environment-specific value for the_variable: MyModule.setup do |my_module_config| my_module_config.the_variable = 42 end This is lovely, and it seems to work (almost) fine. The problem is that in development mode, Rails via ActiveSupport::Dependencies unloads a load of modules, and reloads them in time for the new request. This is usually a great behaviour because it means you don't need to restart your localhost server when you make a code change. However, this also clears out my initialised the_variable variable, and when the next request comes in the initialiser (obviously) isn't run again. The net effect is that subsequent requests end up having MyModule.the_variable set to nil rather than the 42 that I'm looking for. I'm trying to work out how to stop Rails unloading my module at the end of the request, or alternatively find another way to cleanly provide environment specific configuration for my modules. Any ideas? :-/

    Read the article

  • How to get the "#" symbol in the :id into the redirect_to method in Rails

    - by Matthias Günther
    Hello, this is a silly questions but I don't understand, why rails isn't evaluating my string as expected. Here is my problem: I want to redirect to an url in the form ~/:controller/index/#_76 redirect_to :action => "index", :id => '#_76' But I'm getting the url in the form: ~/:controller/index/%25_76 and so my anchor for linking to a certain place in the website isn't working. Can someone please explain me, why rails makes this rendering? I think this hase something to do with url encoding. Again thanks for your help, I'm learning every day a little bit more about rails :).

    Read the article

  • Rails Named Scope and overlapping conditions

    - by Tumtu
    Hi everyone, have a question about rails SQL generation: class Organization < ActiveRecord::Base has_many :people named_scope :active, :conditions => { :active => 'Yes' } end class Person < ActiveRecord::Base belongs_to :organization end Rails SQL for all active people in the first organiztion Organization.first.people.active.all [4;36;1mOrganization Load (0.0ms)[0m [0;1mSELECT TOP 1 * FROM [organizations] [0m [4;35;1mPerson Load (0.0ms)[0m [0mSELECT * FROM [people] WHERE ((([people].[active] = 'Yes') AND ([people].organization_id = 1)) AND ([people].organization_id = 1)) [0m Why Rails generates "[people].organization_id = 1" condition twice ? Does someone know how to make it DRY ? e.g. SELECT * FROM [people] WHERE (([people].[active] = 'Yes') AND ([people].organization_id = 1))

    Read the article

  • Get data from html form to ruby in Ruby on Rails

    - by Maestro1024
    Get data from html form to ruby in Ruby on Rails I have some html like this <html> <h1>Text to PDF</h1> <textarea name="comments" cols="40" rows="5"> Enter your Text here... </textarea><br> <input type="submit" value="Submit" /> </form> </body> </html> I want to give the value of the text into the controller for this page/view. How do I do this with rails? I am new to rails, what is the mechanism for this? I don't need to write to the database just want to hand it to the controller. If there is a good tutorial for this sort of thing that would be great, I am not convince I am approaching this correctly.

    Read the article

  • Get Rails to save a record to the database in a non-UTC time

    - by Shaun
    Is there a way to get Rails to save records to the database without it automagically converting the timestamp into UTC before saving? The problem is that I have a few models that pull data from a legacy database that saves everything in Mountain Time and occasionally I have to have my Rails app write to that database. The problem is that every time it does, it converts the time I give it from Mountain Time to UTC, which is 6-7 hours ahead (depending on DST)! Needless to say, this really messes with reporting on that database. If I could get around doing this, I would. Unfortunately, I can't do anything about the fact that this other database uses a different timezone, nor can I really get away from the need for this app to save to that database occasionally. If I could just get Rails to stop trying to help me, it'd be great.

    Read the article

  • Rails STI validation inheritance

    - by KARASZI István
    Dear Rails users! I have STI models in my Rails application. The ancestor model has validations with the validates_... methods which are working fine. But I have custom validations as well, and I would like to add more different custom validations in the descendants. These custom validations would depend on the class. If I write class DescendantA < Ancestor protected def validate # ... end end It simply overwrites the original validations. Is there a convention to do this in Rails?

    Read the article

  • Fix N+1 query in "declarative_authorization" gem using gem "bullet"

    - by makaroni4
    Currently I am working on one big web application and to make it work faster I decided to refactor all N+1 queries (to decrease number of requests to database, http://rails-bestpractices.com/posts/29-fix-n-1-queries). So I installed gem "bullet" which doesn`t work with Rails 3.1.1 now (you can use fork from https://github.com/flyerhzm/bullet). When using declarative_authorization gem on each page I get same alerts: N+1 Query detected Role => [:permissions] Add to your finder: :include => [:permissions] N+1 Query detected Permission => [:permission_rules] Add to your finder: :include => [:permission_rules] CACHE (0.0ms) SELECT "roles".* FROM "roles" CACHE (0.0ms) SELECT "permissions".* FROM "permissions" WHERE "permissions"."role_id" = 1 CACHE (0.0ms) SELECT "permissions".* FROM "permissions" WHERE "permissions"."role_id" = 2 CACHE (0.0ms) SELECT "permissions".* FROM "permissions" WHERE "permissions"."role_id" = 3 CACHE (0.0ms) SELECT "permissions".* FROM "permissions" WHERE "permissions"."role_id" = 4 CACHE (0.0ms) SELECT "permissions".* FROM "permissions" WHERE "permissions"."role_id" = 6 CACHE (0.0ms) SELECT "permissions".* FROM "permissions" WHERE "permissions"."role_id" = 7 CACHE (0.0ms) SELECT "permissions".* FROM "permissions" WHERE "permissions"."role_id" = 8 CACHE (0.0ms) SELECT "permission_rules".* FROM "permission_rules" INNER JOIN "permission_rules_permissions" ON "permission_rules"."id" = "permission_rules_permissions"."permission_rule_id" WHERE "permission_rules_permissions"."permission_id" = 30 CACHE (0.0ms) SELECT "permission_rules".* FROM "permission_rules" INNER JOIN "permission_rules_permissions" ON "permission_rules"."id" = "permission_rules_permissions"."permission_rule_id" WHERE "permission_rules_permissions"."permission_id" = 31 ... Could you please help me with that and to make this queries faster?

    Read the article

  • Modal windows plugin to rails

    - by VP
    Hi, I'm starting to digg some rails plugins to create modal forms in rails. Almost all documents that you find are too old (2006,2007) or more focused in php. I would like to create a "feedback" tab that when you click on that, it opens a form. For example, you can check the railscast website, http://railscasts.com/. Ryan Bates made it in his website, but didnt make any screencast about it. any idea/tip about a rails plugin to work with jquery and to do those forms?

    Read the article

  • Creating DB views in Ruby on Rails

    - by Zigu
    Hey guys, I'm building a "reports" functionality to a project. 3 roles here: 1) Volunteers (they report what hours they volunteered) 2) Supervisors (they look at the reported stuff, note: one supervisor can view all projects) 3) Projects (Represents a work project that some collection of volunteers work on) To explain what it does: A report will be specified by the supervisor to generate based on a query of what he needs. These could be plausible reports: 1) The total number of volunteers, and the total amount of volunteer hours on this project 2) All the volunteer's names and emails associated with a project 3) The number of active projects vs. the total number of projects I was thinking maybe that creating a view in rails and storing the name of that view so Rails will just check the view whenever a supervisor wants to pull up the "report". Is a view really the answer or is it better to just save a query? Can Rails do this or is there an even better or more simple way of achieving this functionality? Cheers, -Jeremiah Tantongco

    Read the article

  • Ruby On Rails CMS Framework

    - by stel
    Hi! I want to create a framework fo rails application. It will be a rails application but packed into gem (like a Radiant CMS). It must work like this: gem install cmsframework and then: cmsframework the_app After that we have a sceleton of rails app without any controllers etc.. - all controllers loaded from cmsframework gem. If I want to rewrite some files (for example public/styles.css) I must simply create it in my app (the_app). If I want new functions in my app I can create a plugin. But the main functionalities must be loaded from cmsframework gem. What is the best way to implement this?

    Read the article

  • how to convert legacy query to ActiveRecord Rails way

    - by josh
    I have a query in my code as below @sqladdpayment = "INSERT INTO payments (orderid, ttlprodcost, paytype, paystatus,created_at,updated_at,userid,storeid) VALUES ('" + session[:ordersid] + "', '" + session[:totalcost] + "', '" + "1"+ "', '" + "complete" +"',current_date, current_date, '"+"1"+"','"+ "1"+"')" Here the table payments and primary key is orderid. Now, I know if I convert this to the ActiveRecord way then I will not have to put update_date, current_date because it will put that on it's own. It will also put orderid on it's own also (auto_increment). I am looking for a way to convert the above query to ActiveRecord Rails way but still be able to put orderid on my own (session[:ordersid]). I do not want to rely on auto_increment because then I will have to refactor lot of the other code. This might be a quick and dirty fix but I want to know whether this type of flexibility is offered in rails? I have wondered about this question many times. Why won't rails allow me to have that flexibility?

    Read the article

  • Missing the Rails 2.3.4 gem. Even though it's installed!

    - by Shereef
    Running Snow Leopard. Tried uninstalling, and re-installing. Still getting the same error whenever I run a rake task. mbpro:redmine shereef$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0] mbpro:redmine shereef$ rails -v Rails 2.3.4 mbpro:redmine shereef$ which rails /usr/local/bin/rails mbpro:redmine shereef$ gem -v 1.3.5 mbpro:redmine shereef$ which gem /usr/local/bin/gem mbpro:redmine shereef$ rake -v (in /Users/shereef/Documents/Code/BetterMeans/redmine) Missing the Rails 2.3.4 gem. Please gem install -v=2.3.4 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed. mbpro:redmine shereef$ which rake /usr/bin/rake mbpro:redmine shereef$ $PATH -bash: /usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin: No such file or directory mbpro:redmine shereef$

    Read the article

  • Reloading Rails Directories on Change for Development, Not in Lib

    - by yar
    I have checked out several questions on this, including all of those you see next to the question. Unfortunately, I'm not working with a plugin, and I don't want to work in lib. I have a directory called File.join(Rails.root, 'classes') and I'd like the classes in this directory to reload automatically in dev. In my environment.rb I have this line config.load_paths << File.join(Rails.root, 'classes') which works fine and blows up if the path isn't there. The reloading line in my development.rb also works fine require_dependency File.join(Rails.root, 'classes', 'blah.rb') which blows up if the file is not there (a good sign). However, the file doesn't reload. This all works if the file is in the root of lib and I use the require_dependency line, but my whole point is to get stuff out of lib as suggested here.

    Read the article

  • Rails controller processing as HTML instead of XML

    - by Andy
    I've recently upgraded from Ruby 1.8.6 and Rails 2.3.4 to Ruby 1.9 and Rails 3.0.3. I have the following controller: class ChartController < ApplicationController before_filter :login_required respond_to :html, :xml def load_progress chart.add( :series, "Memorized", y_memorized ) chart.add( :series, "Learning", y_learning ) chart.add( :series, "Mins / Day", y_time ) chart.add( :user_data, :secondary_y_interval, time_axis_interval ) respond_to do |fmt| fmt.xml { render :xml => chart.to_xml } end # Also tried # respond_with chart end end However, when I call the 'load_progress method' I get the following: Started GET "/load_progress.xml" for 127.0.0. Processing by ChartController#load_progress as HTML Completed 406 Not Acceptable in 251ms I have also tried changing the respond_to block to respond_with chart But I get the same response. I've read all the new Rails documentation on the new respond_with format but I can't seem to elicit an XML response. Am desperately hoping someone has some ideas.

    Read the article

  • Why is rails called a dsl?

    - by b_ayan
    Recently, when I tried to explain why Rails is a DSL to an intern at my organisation, I was not able to articulate my reasonings to the effect I would like to. Maybe I do not understand the space well enough to teach the nuances. Redirecting him to Martin Fowler' article or the google ranked one InfoQ or other material has not helped much either. Can some explain why Rails is a DSL with an example / parallel situation which is not voodoo stuff for someone who is fairly new to the world of code? Understanding the ideology might also help in elaborating the intricacies of the rails ecosystem?

    Read the article

  • Rails - Sending XML or JSON

    - by timWhit
    I'm new to Rails and trying to send a request to Chargify to cancel a subscription. Their API says I need to send the method DELETE to a xml URL. This isn't a Chargify based question but rather... how would I have a user click a button that then generates this request and sends it within my Rails app? You can view this url to see what I"m trying to do - http://docs.chargify.com/api-subscriptions#cancel. Also it's working fine when I run a command-line test so I know my code works, just now sure how to put it into my Rails app (view/controller). Thanks

    Read the article

  • Related Models in Rails 3

    - by Jack
    Hi, I am just starting my first Rails 3 project and am having some difficulties. I have two related models, projects and clients. I have set up the relationships as has_many and belongs_to. However in my projects views I can only access the client_id of the project. I would like to access the client's name and other parameters. I am sure that previously in rails, I could just use project.client.name, but this is not working. Is there a new feature of Rails 3 that I have missed? Cheers

    Read the article

  • Ruby on Rails in SpringSource tool suite?

    - by Martin Klosi
    I have been using Grails for some time now, but in school they are making us use Ruby on Rails. I have been trying to find an extension for ruby on rails for STS as there is for Grails, but I have failed. The only thing that comes close is a plugin so i can use ruby code in my Grails app using JRuby. I just want to make sure that a fully integrated extension DOESN'T exist. If that is the case, what would be the graphical IDE way of developing in ruby on rails, the same way one would use STS for Groovy on Grails development? (preferably free :) )

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >