ruby-on-rails

OpenId + Bort + google

Hi I'm new in using ruby and i wanted to implement the openid feature that came with the bort template... I used the google openid url https://www.google.com/accounts/o8/id in the sign up but it cant get the email that i used in the openid login.. here's a part of my code... its the standard code from the bort template def create lo...

how to erase sql quries from ActiveRecord::Base.logger

Hi All, I'm developing an application using Ruby on Rails. I would like to erase old queries in the ActiveRecord::Base.logger object every time when i call a new action, essentially where ENV = production. the goal is not to erase all queries like using config.log_level :info. i need only last queries to build a file whith those quiri...

Link for action problem

Hello all, I have problem with my application. I have table report, there are 2 column , user_id and comment_id I created link on article comment view <%= link_to "[ ! ]", report_comment_url(comment) %> class CommentsController < ApplicationController def report @comment = Comment.find(params[:id]) @comment = CommentRep...

Ruby 1.8.6 BigDecimal.to_f always returns '0,0' on Solaris

Hi, I have come across a very weird error. I'm on Solaris 10, using Ruby Enterprise Edition (ruby 1.8.6 (2008-08-08 patchlevel 286) [i386-solaris2.10]) with Rails 2.3.4. I have a very weird error. In irb: irb(main):001:0> require 'bigdecimal' => true irb(main):002:0> b = BigDecimal.new('123') => #<BigDecimal:834d0e8,'0.123E3',4(8)> ir...

get the id/value/name of checkboxes generated in form with rails

I'm using a fields_for helper in rails with some text boxes. How can I get the ID of these text boxes to use in some Javascript? I would like to be able to manipulate the status of the other checked boxes by clicking on certain boxes. Thanks :) Stuff like: <% fields_for "[id][]", app do |fields| %> <%= fields.check_box :featu...

Alter existing model with a Redmine plugin

The Redmine plugin tutorials explain how to wrap core models but what I need is to add another column to the journals table. I need a boolean field inserted in the journals model. Creating another model with a 'belongs_to :journal' relation seems like an overkill. Can this be done with a plugin? I should note that I am a rails newbie. ...

PostgreSQL, Rails and :order => problem

I have the following line in my ActiveRecord model: class Record < ActiveRecord::Base has_many :users, :through => :record_users, :uniq => true, :order => "record_users.index ASC" This is intended to enable me to read out record.users in a way that I order using an index field in the record_users model. The problem is that this f...

How to get the cron working when using Javan-whenever in Rails

I have setup my schedule.rb file as follows. set :cron_log, "/log/cron_log.log" if Rails.env.development? every 1.minute do runner "SomeModel.move_values" runner "SomeOtherModel.dispense" end end I also make it work in development mode by whenever --update-crontab trunk --set environment=development But my model methods...

rails passenger doesn't boot correctly

i'm trying to get working an old rails 2.1 application configured with mongrel cluster. passenger is correctly installed on my system (apache) with this configuration LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5 PassengerRu...

Save other model's fields from a certain view

Hi everyone, I'm really new at Ruby On Rails and I'm working with a baseApp that comes with the login and user registration functionalities. It also creates an empty profile for a user when they sign up. Then, I've created a migration to add fields to the profiles table, such as firstName, gender, state, country, etc. What I'd like to...

delayed_job talking to acts_as_ferret via drb server results in a closed stream error

I'm using delayed_job to process some files and then create some activerecord objects with the results. The activerecord objects are being indexed with acts_as_ferret which is running as a drb server. When delayed_job processes the job, everything goes fine until it reaches the point when active record tries to talk to ferret via the dr...

Better way to retain form data on manual back redirect?

I have a form that, on submit, requires the customer to look over the data, and then confirm the changes before saving the data. However, I'm using a really rough way of retaining data if the user hits the back button to go back and look over the data before submitting. Since I want the user's updates to the fields and not the current ...

Default value for date_helper in formtastic

As basic as it sounds, I can't make the date_helper default to a date, as in: - semantic_form_for resource do |f| - f.inputs do = f.input :issued_on, :default => Date.today = f.buttons The above just renders blank columns if resource does not have a date. Would appreciate any pointer on what I'm possibly doing wrong. ...

HeyWatch gem + Rails - weird problem

I'm using the HeyWatch gem for video conversion in my Rails app. It works great, but I’m getting different results from Video.create, depending on which machine I use. I’m using the same Rails app (updated from svn), same Rails version 2.3.4, same Heywatch gem 0.0.1 (uninstalled/reinstalled). Ruby is 1.8.6 on both, as well. On my laptop...

Safe ERB Language?

I wonder if there is a safe template that reassemble ERB. ERB is very easy to use, but the deadly part to use that in a CMS is the over powerful access (you can just write some really nasty stuff with that in a matter of seconds...) So I wonder if there is any chance such language exist. Please I don't want radius/liquid..... writing ex...

replace_html or insert_html

Hello stackoverflow pals.I am a new rails learner. My question is: I am listing all items in index and also i am usin some ajax in this page to insert new items to database. After inserting new items to database, should i get all items from database again and replace whole list of items or just add new item to list by using insert_html? ...

What role do ActiveRecord model constructors have in Rails (if any)?

I've just been reading this question which is about giving an ActiveRecord model's date field a default value. The accepted answer shows how to set the default value from within the controller. To my mind, this sort of business logic really belongs in the model itself. Then I got to thinking how if this were Java I'd probably set the in...

extending email confirmation to Authlogic

I recently implemented Authlogic to my project for authentication. I followed http://railscasts.com/episodes/160-authlogic and had it up and running. Wanting to add email confirmation, I found this and followed it: http://github.com/matthooks/authlogic-activation-tutorial Now, when I try to sign up I get a method missing 'login=' for Us...

Ruby and Nil Object

I am developing a webapp (well trying to) in Ruby on Rails. I have a partial render in my index.html.erb <%= render :partial => "houses/index", :locals => @houses %> index.html.erb is loaded when the user hits the root of my domain. This partial cause this error: You have a nil object when you didn't expect it! You might have expe...

How to close a ZipFile

I'm passing a dynamic zip file location to a def from a database. I want to unzip the file to a temp location, extract the xml report file inside, apply an xslt stylesheet, copy it as an rhtml to a view directory for rendering, and delete the temp extracted xml file. The functionality is working fine (the rhtml file is overwritten each t...