ruby-on-rails

One configuration per domain name on the same application. How to easily access config values from models?

Hi, I run a Ruby on Rails website that have multiple domain names. I have a "Website" table in the database that stores the configuration values related to each domain name: Website - domain - name - tagline - admin_email - etc... At the moment, I load the website object at the start of each request (before_filter) ...

Heroku Create Unknown Protocol SSL Error

Hi, I'm new to Ruby and have created a site in Rails, I'm trying to run heroku create on my Windows machine and after generating a public key through git gui, I'm getting this error Uploading ssh public key C:\Users\me/.ssh/id_rsa.pub c:/ruby/lib/ruby/1.8/net/http.rb:590:in connect': unknown protocol (OpenSSL::SSL::SSLError) fr...

Pushing app to heroku error

Hello, I am getting the following error when I try to push my app to heroku. I saw a similar thread on here, but the issues seemed related to OSX. I am running windows 7 $ git push heroku master Counting objects: 1652, done. Delta compression using up to 4 threads. fatal: object 91f5d3ee9e2edcd42e961ed2eb254d5181cbc734 inconsistent o...

How to restrict text search to a certain subset of the database ?

I have a large central database of around 1 million heavy records. In my app, for every user I would have a subset of rows from central table, which would be very small (probably 100 records each).When a particular user has logged in , I would want to search on this data set only. Example: Say I have a central database of all cars in t...

content_tag_for a collection in Rails?

I have a Post model. Posts have many Comments. I want to generate a <ul> element for post.comments using content_tag_for. Ideally, it'd produce <ul id="comments_post_7" class="comments"> ... </ul> where 7 is the ID of the Post. The closest I can get uses <% content-tag-for :ul post, :comments do %> which produces <ul id="com...

Can 'locals' be used with 'collection' when rendering partials in Rails?

Everything works okay when I try to render a partial like this: = render :partial => "/shared/enquiry/car_type", :collection => @enquiry.available_car_types However, if I also want to pass a variable (in this case 'path', because I'm sharing this partial across two forms), the path is not available to me: = render :partial => "/share...

message subject in windows firefo browser comes in integer i.e 0

I have implemented message facility in ruby on rails, in which, when one replies to the message the subject for example:- "Hi" appears properly in fedora operating system. But in windows it appears as "0". What must be the problem? Thanks & regards, J.Pallavi Patnaik ...

Is this type of calculation to be put in Model or Controller?

i have Product and SalesOrder model (to simplify, 1 sales_order only for 1 product) Product has_many :sales_orders SalesOrder belongs_to :product pa = Product A #2000 so1 = SalesOrder #1 order product A #1000, date:yesterday so2 = SalesOrder #2 order product A #999, date:yesterday so3 = SalesOrder #3 order product A #1000, date:now...

Redmine configuration - Rake: Don´t know how to build task environment.

Hi, I´m configuring Redmine for the first time. Everything works fine except for the incoming emails part. I have downloaded the latest version of email.rake and I´m invoking it using the following command: rake -f "C:\Archivos de programa\BitNami Redmine Stack\apps\redmine\lib\tasks\email.rake" RAILS_ENV=production redmine:email:receiv...

Resque: Slow worker startup and Forking

I'm currently moving my application from a Linode setup to EC2. Redis is currently installed on a remote instance with various worker instances interacting with the queue. Thats all going fantastic. My problem is with the amount of time it takes for a worker to be 'instantiated' and slow forking. Starting a worker will usually take ...

How to combine two models in one RoR acts_as_tree treeview?

I have two simple models each with acts_as_tree, say Departments and Employees. My goal is to create a treeview combining both models in to one overall tree, like so: Department 1 SubDepartment 1.1 Employee A Employee B SubDepartment 1.2 Department 2 Subdepartment 2.1 Employee C Department 3 SubDepartment 3.1 Employee D E...

[Rails3] How to do multiple many to many relationships between the same two tables.

Hi. I have a model of a club where I want to model the two entities Meeting and Member. There are actually two many-to-many relationships between these entities though, as for any meeting a Member can either be a Speaker or a Guest. Now I am an OO thinker, so would normally just create the two classes and each one would just have two a...

Determining which video format to use

I want to upload a video file and convert it to flash and 3gp/mp4. No problem, plenty of tuts for this out there using paperclip and ffmpeg. For some reason I thought there was a tut that showed if std browser play flv but if mobile then use 3gp/mp4 but can't seem to find it. Any one know if there is a tut like this out there? Else, ...

How do you create a sharesystem between two nodes in a cluster for a Rails app?

I deployed to a cluster, and realized that each node holds its own independant database. I am currently using Engine Yard as my host. How can I create a sharesystem so that all my nodes/instances share the same file system? Some people recommend S3, but this may not be the best choice because my users need to be able to edit their fil...

Ruby on Rails integrable CMS

I need to integrate a blog in my web app, but it would be pretty cool if I could use an existing CMS. It doesn't have to be a CMS developed in RoR. Actually, if you know about a CMS with an good API it would be just great. ...

How to get array with clear data from Active Record query without using map

Hi I would like to ask if its possible get array with clear data from ActiveRecord query without using map, collect or each. names = User.find(:all, :select => "name") return names == [#<User name:"Peter">,#<User name:"Martin">] and I want names == ["Peter", "Martin"] without using map, collect or each. Thanks for your answers. ...

Rails render partial with block

I'm trying to re-use an html component that i've written that provides panel styling. Something like: <div class="v-panel"> <div class="v-panel-tr"></div> <h3>Some Title</h3> <div class="v-panel-c"> .. content goes here </div> <div class="v-panel-b"><div class="v-panel-br"></div><div class="v-panel-bl"></div...

'uninitialized constant ActionPack' when starting rails

When starting my rails server I'm getting an 'uninitialized constant ActionPack' error. raw stack trace I'm using blunder with rails 2.3.8 running 'bundle list' shows: * actionmailer (2.3.8) * actionpack (2.3.8) * activerecord (2.3.8) * activeresource (2.3.8) * activesupport (2.3.8) * acts-as-taggable-on (2.0.6) * auth...

redirect error and recursive login screen/auth screen problems with facebooker iframe

i am using the facebooker gem from http://github.com/mmangino/facebooker for developing a rails 2 facebook application (iframe). i am wondering if this is a bug from facebooker: when i am using ensure_application_is_installed_by_facebook_user in the application controller, the iframe gets rendered in an infinite loop. i found out tha...

remove field name from object validation message

I've got a simple active record validation on an object using this within a form: form.error_messages({:message => '', :header_message => ''}) This in turn outputs something like "FieldName My Custom message" What i need to do is remove the field name from the error message but leave my custom message. Can anyone point me in the r...