ruby-on-rails

Clip content from remote website using javascript and Iframe ??

Is there any helper for Iframe in Rails ?? *EDIT:*I have a link which redirects to a remote website , i need to get the COntent from that website and store in my application is this possible , I dont need a browser extension or plugin. ...

Change default stylesheet dir in rails

Would anyone know to change the default stylesheet directory /public/stylesheets to /public/css in rails 3? I found a variable called config.stylesheets_dir = '/css' This didn't work though. I know I can do <%= stylesheet_link_tag '/css/mystyle.css' %> but I'm curious if there's a better way. ...

Postgresql full-text-search on heroku

Hello I want to use full-text search using postrgresql but the problem on heroku, i can not think of a way to have custom dictionary using my language (Greek). on my pc I did CREATE TEXT SEARCH DICTIONARY greek_ispell ( TEMPLATE = ispell, DictFile = greek, AffFile = greek, StopWords = greek ); and setup the sharedir using the custom...

Any way a db change can trigger a method call in Rails?

Is there any way a database change (say an insert statement) can trigger a call to a ruby method in my app? I know about observers but this is sort of a complicated situation, because the database is updated by a Java application. Note, both the Rails and the Java app connect to the same database. ...

problem in downloading large file(1.1 Gb) using Xsendfile module

Hi all, I am Running Apache as frontend server to mongrel and uploaded 1.1 Gb of file using my rails application .Now I am trying to download same 1.1 GB stream ,for that i loaded mod_xsendfile.so in apache httpd.conf file and using send_file function downloaded this 1.1 gb of stream successfully.but after downloading it ,...

generate documentation from javascript

How are you generate documentation for javascript ? Especially in a rails application ? Any plugins to rdoc or something similar ? ...

Rails 3 returning a HTTP 406 Not Acceptable?

I have the following controller code: def create @admin = Admin.new(params[:admin]) respond_to do |format| if @admin.save redirect_to(@admin, :notice => 'Admin was successfully created.') else render :action => "new" end end end def update @admin = Admin.find(params[:id]) resp...

Ruby on Rails: CSS and skins management

I have a skin support in my app. I'm looking for a tool, which will enable the customer (not the programmer, which is current) alter the skins. Is there an admin tool (gem, plugin) for Rails to manage (edit, create, view) these skins? I looking for some easy solution like /admin/skins page where I could do all the stuff, otherwise I'm g...

Next is not defined for a facebook application.

Hi, I am trying to implement Facebook Connect with the new facebook connect.js1. I am following "Single Sign-on with the JavaScript SDK" documented at: http://developers.facebook.com/docs/authentication I Initialized connect.js like following: <div id="fb-root"></div> <script language="JavaScript" type="text/javascript"> wi...

ActiveRecord callback setup from different model

Let's say I have to simple models First and Second, and there is one to one relationship from Second using belongs_to :first. Now I want to do something with Second, when First is saved. But I don't want to setup an after_save callback in First, to deal with Second. I want to keep my models clean, and unaware of each other as much as po...

Get the evaluated HTML code from a template in Ruby on Rails

For some reason, I want to store the HTML code outputted from render into a database. For example, this is the content of a template (app/views/mailer/someview.html.erb): Hello <%= @foo %>. And I would like to store "Hello Jim." in my database by providing the template (mailer/someview) and the variables to replace (:foo => "bar"). ...

Rails hosting advice - EngineYard, Heroku, EC2

Hi, I'm developing a very sensitive application for a client that needs to have 99.9999999999% uptime guarantee. It's a Rails application with MySQL database. I am thinking of hosting it on EngineYard due the low maintenance requirements and easiness to run. Heroku does not seems to be the perfect solution due to uptime problems. EC2...

Multiple Models for one login with Devise?

Is it possible to configure Devise to accept logins for multiple models (either User or Admin) from the same form? ...

Connect with Amazon S3 and upload a file

I am trying to connect with Amazon S3 I have the aws-s3 (0.6.2) gem installed. But I keep getting the following error: undefined method `xml_in' for nil:NilClass I can't find out what's the problem, also several searches on Google turns out in to nothing. I hope someone here can tell me more about this error. My code: require 'rake'...

Rails 3 > Rendering views in rake task

Hello there, I'm stuck with a rake task that need to prepare a newsletter for Mailchimp. Using rails 2.x stuff googled I now have this code: desc "Sends newsletter to Mailchimp list" task :send_newsletter => :environment do begin # get render helpers av = ActionView::Base.new(Rails::Application::Configuration.new(Rai...

How to use a gem in Rails 3 without referencing it in the Gemfile.

I'm wondering how to make a gem accessible in a Rails 3 app without putting a reference to it in the gemfile. I want to do this with ruby-debug (I'm using ruby-debug19). I use this to debug, but not everybody on my team does and forcing the dependency just so I can use it doesn't seem very diplomatic. Is there another way? If it ends up...

Rails 3 ActionDispatch scope options

Do you know a resource which documents all the available options for the ActionDispatch scope method and their usage? I'm quite tired of digging into each merge_X_scope method trying to understand the X option implications. ...

Parse, edit and output CSS in Ruby

Is there a gem to perform css editing and parsing in Ruby? What I need is to open css file, perform a find by a selector, alter it and save the output. The best way would look as following: draft = CSSParser.load('structure.css') draft.find('#header a').style('color', '#333') draft.render What's the most appropriate way to do that? ...

Any easy way to change a Name for a Model?

Hello, I've been building an app recently that has a model Books that is a database table and linked to several models/controllers. I recently learned that instead of Books it needs to be called publications (just an example)... I now want to update the database and all the mentions throughout the app. Is there a simple way to do that i...

Best practice: Ruby/Rails Rspec regex testing

Could you tell me how to test regex-code correctly? I test my user-login attribute with following code: # user.rb class User < ActiveRecord::Base #... validates_format_of :login, :with => /^[a-zA-z0-9_.]{3,18}$/ end # user_spec.rb describe User do before(:each) do @user = Factory.build(:user) @user.save end subject...