ruby-on-rails

breakdown of a install.rb file, please help me understand this

I'm looking at the install.rb file of RoR open source project: version = ARGV.pop %w( core api auth dash promotions sample ).each do |framework| puts "Installing #{framework}..." `cd #{framework} && gem build spree_#{framework}.gemspec && gem install spree_#{framework}-#{version}.gem --no-ri --no-rdoc && rm spree_#{framework}-#{ver...

Rails 3 Observer -- looking to learn how to implement an Observer for multiple models.

Hi! I have the following Observer: class NewsFeedObserver < ActiveRecord::Observer observe :photo, :comment def after_create(record) end end What'd I'd like to learn how to do is add a SWITCH/IF statement in the after_create, so I know which model was created Something like: after_create(record) switch model_type case "photo"...

Rails 3 - Oberserver - Not able to user the Devise @current_user

Hello, Im building a Rails 3 app, and have an Observer... in the observer I need to user the current_user var that DEVISE allows me to user across my views... How can you use the current_user.name or current_user.id in the Observer? Thank you ...

Prototype > JQuery Conversion

Hi! I need to convert one script from Prototype to Jquery, but I'm no good with Jquery. If someone can do this, i will thank so much =) Here's the code in Prototype: // Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults replace_ids = functio...

Simple JQTouch question about creating dynamic links to content

Hello, I've looked at many JQTouch tutorials but I haven't found a description on a simple thing: Given a list of items, how do you turn each item into a link that then brings up a dynamic page showing data about that item? Here is the flow I what I want to do: 1) Present list of items 2) Item is tapped 3) an XML call is made to the s...

Rails 3 Form Helpers: UTF8 and other hidden fields

The view: <%= form_for :blog_post do |f| %> <ul> <li> <%= f.label :title %> <%= f.text_field :title, :type => 'text', :id => 'title', :size => '', :limit => '255' %> </li> </ul> <% end %> <!DOCTYPE html> <html> <head> <title>LevihackwithCom</title> <script src="/javascripts/prototype.j...

Use selenium rc in my rails app, in dev mode rather than test mode?

Hi all. I have rspec and seleniumrc working normally in my test environment. However, I want to be able to use seleniumrc in a ruby app (not necessarily rails) so that i can click around a website (in a looped, generative sort of way) and permanently save data to the database, without it being rolled back at the end as in a regular rsp...

Getting "Unknown attribute error" Anyone help fixing?

(Sorry for long post) Ok guys, so I'm having some issues with something I'm trying, I've been trying to fix it for a long time now, and It's now time to ask for help. Ok, so I have these "grinders", and I want a user to vote for each one, I did two scaffolds: grinder grinder:string posted_timestamp:datetime poster_ip:string votes_up...

One column not showing up when using active scaffold

Hi, I am using active scaffold on my website. Recently I added a new table and one of the columns is not showing up when accessing the application. Can anyone help me in debugging this? I have been stuck with this for the past two days. Thanks, Sivakumar. ...

response.should have_text leads to undefined method `has_text?'

I would like to test a controller that directly renders some JSON output (by using "render :json => @entity_names"). For that task I tried in my spec file "response.should have_text('["enim", "enita"]')". Unfortunately I always get that error: Failure/Error: response.should have_text('["enim", "enita"]') undefined method `has_text?' for ...

i want to make instant connection with web application (rails) with desktop application that build with C#.net

i have a web that provide a form to send SMS deployed on other server and a desktop application that is on my local machine serving as gateway. i wants when some user fill the form and submit it, then this sms delivered to desktop app to serve the request instantly. currently my local machine is interacting with the server after 30s then...

tackle different types of utf hyphens in ruby 1.8.7

We have different types of hyphens/dashes (in some text) populated in db. Before comparing them with some user input text, i have to normalize any type of dashes/hyphens to simple hyphen/minus (ascii 45). The possible dashes we have to convert are: Minus(−) U+2212 &minus; or &#x2212; or &#8722; Hyphen-minus(-) U+002D &#45; Hyphen(-) ...

delayed job and monit

Can't seem to get delayed job to get running with monit. here is my delayed_job.monitrc file.. check process delayed_job with pidfile /var/www/app/shared/pids/delayed_job.pid start program = "cd /var/www/myapp/current && script/delayed_job start RAILS_ENV=production" as uid deploy and gid www-data stop program = "cd...

Rails belongs_to and single table inheritance not behaving

I have a Bike model and a Component model. Several models inherit from Component: Frame, Chain, Crankset etc. When I submit my form, my params look like this: "bike" => { "frame" => { "id" => "4" }, "chain" => { "id" => "19" }, ... } In my controller, the following code breaks: @bike = Bike.new(params[:bike]) > Frame(#90986230) expe...

Importing in wordpress Blog

Hai i am a ruby on rails programmer I want help in How to export my website blog and import in wordpress? ...

How do I properly span a table on multiple pages in htmldoc with rails?

I am using HTMLDOC to create pdfs in ruby on rails. The problem is table rows seem to get cut off at the bottom of the page. Is there a way to make the rows continue instead on the next page? Any help would be appreciated. ...

Writing spec for controller actions that return XML -- Ruby on Rails

In my controller I have some methods which return json as well as xml data. I need to test those actions. For testing the json part I found this reference and it is working fine. Now I am need of testing the actions for the XML part. Anyone who can help or suggest something are most welcome I've been scratching my head for an hour now bu...

Importing to wordpress

I have a blogging service and would like my users to be able to export their blog from my site to Wordpress. Can someone guide me in creating OPML/XML format or any other way to allow them to import I am using Ruby on Rails 2.3.2. ...

Formtastic. How to create a form for multiple objects of the same model?

I have a subject model with two fields - "name" and "level". I want to be able to visit "/subjects#new" and add 10 subjects objects at once. How can I do this in formtastic. In regular forms I would do this: <% @subjects.each do |s| %> <% fields_for "subject[#{s.id}]", s do |f|%> ...

Best recaptcha library for Rails 3

What is the best recaptcha library for Rails 3? I found three projects: ruby recaptcha, rack recaptcha, recaptcha ...