how to update_attributes with the conditions?
I need to update attributes but only for rows with the specific conditions like ["recipient_id = ? and inbox_id = ? and status='unread'", current_user.id, @inbox.id] How do I do it? ...
I need to update attributes but only for rows with the specific conditions like ["recipient_id = ? and inbox_id = ? and status='unread'", current_user.id, @inbox.id] How do I do it? ...
I have following code in my controller def create @employees = Group.find(params[:employee][:group_id]).employees puts "count!!!!" + @employees.count.to_s Communicate.deliver_message(params[:subject],@employees,params[:body].to_s) flash[:notice] = "your message has been sent" redirect_to root_url end following ...
Whenever I add a new feature (eg. something I downloaded) I tend to want to put all the files (css, html, js, images) in one place. Symfony 2.0 will have this new feature they called bundle system. Everything will be in its own folder. This will be great for adding new features so you don't have to mix all css, js, image files with each...
Hi. Everything seems to be working fine with my implementation of Facebooker with Authlogic (using the authlogic_facebook_connect plugin) except for one thing. After the initial authorization of the application (by clicking OK on the Facebook pop-up) I still remain on the login page. There is no redirection. However, once I refresh the...
how to include header and footer information on each page of a pdf in rails(prawn).How to identify the top of each page in a pdf.I need a header function from which page count,created on ...need to display; and i can call the same function for different reports. i am using prawn (0.8.4). Can anybody give some solution.. ...
I am sending emails with the following method: class Communicate < ActionMailer::Base def message(sub,msg,people) subject sub bcc people from '[email protected]' sent_on Time.now body :greeting => msg end end bcc contains 4 or 5 email addresses. During my testing I've noticed two ...
I'm relying on the id field of postgresql records not changing in a rails app. Certain tests have indicated that postgres might be changing the ids of some of the records. Does postgres do this? ...
class C1 unless method_defined? :hello # Certainly, it's not correct. I am asking to find something to do this work. def_method(:hello) do puts 'Hi Everyone' end end end So, how to judge whether a mehtod has defined or not? ...
Has anyone tried to test the Authlogic "Remember Me" functionality with Cucumber? I am not sure how to get webrat to "close a browser" to test persistence. Only thought is maybe it requires selenium? Is there a way to do without? ...
Can anybody tell me how to parse this on rails. <?xml version="1.0" encoding="utf-8"?> <message> <param> <name>messageType</name> <value>SMS</value> </param> <param> <name>id</name> <value>xxxxxxxxxxxxxx</value> </param> <param> <name>source</name> <value>xxxxxxxxxxx</value> </param> <param> <na...
I have inherited a web app with the following tables: Categories, SubCategories and Pages. Pages has category_id and sub_category_id columns. I need to write an efficient query to eager load pages by category and sub_category for iterate in my view (crude example follows): - Category One (categories.each do |category|...) -- Page One ...
hi in javascript i can call prompt like this var retVal = prompt("Enter the new first name : "); how can i call same prompt in rjs file i used, page.prompt("Enter the new first name : ") and its not working ...
We use rails version 2.3.5 This error has been reported in SO here I tried the following: adding config.cache_class = true - the problem with this was that, the server had to be restarted every time a change was made to any controller. Also the server start time was too long adding unloadable to the middleware - no use adding config....
Is it possible conditional sort in hash my hash like {1=>"10",2=>"20",3=>"30",4=>"40",5=>"50",6=>"60",7=>"70",8=>"80",9=>"90"} wanted result is {7=>"70",8=>"80",9=>"90",1=>"10",2=>"20",3=>"30",4=>"40",5=>"50",6=>"60"} add condition in this code operation_hour_hash.sort{|key,value| key[1]<=>value[1]} ...
Hi, I have a table called as language which has a column called as lang_code. It has the following values. id lang_code created_at updated_at 1 ARA 2010-07-29 15:27:25 NULL 2 CHI 2010-07-29 15:27:25 NULL 3 DAN 2010-07-29 15:27:25 NULL 4 DEU 2010-07-29 15:27:25 NULL 5 ESP 201...
I need help on what I think should be an ActiveRecord Callback. What I am trying to achieve is, each time a particular record is saved, ActiveRecord actually saves 2 records in the same table. I will stay away from why I want this, it should be good enough to know that each transaction needs 2 separate but similar records saved in the ...
HI guys, I am new to rails and just doing my first registration form. I have some validations that I want rails to check but for some reason it does not show the error messages. On the views/user/signup.html.erb I have this <h1>Register Now!</h1> <% form_for :user, @u, :url => { :action => "signup" } do |f| %> <%= f.error_messages ...
hi, how i can assign rjs prompt value to a variable page << "prompt('Enter the new first name:');" when i call in alert ...
Is there a simpler code to set the Headers and Footers on all N pages in a PDF file that is generated by PRAWN Plugin. the codes are to be written in a "report.pdf.prawn" file, which is a direct coding area of the PDF view page The below are the codes in the file report.pdf.prawn pdf.text "Creation Date " + Time.now.strftime('%d-%m...
I've got a Ruby on Rails app where I do the following: @user = User.find(:first, :conditions => ['LOWER(username) = ?', current_subdomain.downcase], :include => :bio) Where ':include => :bio' is the important part. Then in the view I want to display some bio: <em><%= @user.bio.title %></em><br /> <%= @user.bio.city %><br /> <%= @us...