ruby-on-rails

no such file to load -- silentale-on-rails (new gem)

I've just completed a new open source gem for the Silentale API and I'm facing a strange issue. In terminal I'm getting an error saying that it can't load the gem however it continues to start the server loading it without any issues. no such file to load -- silentale-on-rails /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem...

How to create an object within involve db in RoR?

I know that I can use the db schema to easily generate CRUD for me. But I want to do a simple login page, it only using the "user" object, check whether the password & user name is correct. So, I want to create an "system" object which have a "login" method. How can I do that in RoR? ...

Rails Actionmailer Attachment Using Paperclip

Hi I have an email messaging system built within my application. There are many different users that can sign on and send emails to certain groups of people. I want to add the capability to send an attachment with these emails. I have no problem getting a set attachment from my HD to send, but clearly I need to allow users to add an att...

How to search a record in RoR?

I know that I can use Query language to find the record I want. I am doing a login page, I want to find the record which match the user name and password, but I don't want to loop all the elements to find out the user I want (<% @users.each do |user| %>), wt should I do in RoR, except typing SQL. ...

How to use "count" in rails to show how many projects/tasks user has?

Hello, I defined method 'count' in my tasks controller as: def count @count = current_user.tasks.count end I'm not sure how to show that in my tasks views. Do I just use Tasks count: <% @count %>? How do I get in my view how many tasks the user has? Thanks ...

mod_xsendfile alternatives for a shared hosting service without it

I'm trying to log download statistics for .pdfs and .zips (5-25MB) in a rails app that I'm currently developing and I just hit a brick wall; I found out our shared hosting provider doesn't support mod_xsendfile. The sources I've read state that without this, multiple downloads could potentially cause a DoS issue—something I'm definitely ...

Why I can't send a post method in RoR?

I have this method to post the value to the "/store/add_to_cart" <form action = "/store/add_to_cart" method="post"> <% for product in @products -%> <div class = "entry"> <%= product.title %> <%= product.price %> <p> </div> <% end %> <%= select( "payment", "id", { "Visa" => "1", "Mastercard" => "2"}) %> <%= submit_tag 'Make Order' %> <...

My rails migrations won't run, and I can't deploy my rails app. How can I start over?

At some point in my rails development I started making database changes (e.g. dropping or altering columns/tables) without using rails migrations. So now I get errors when I try to deploy my rails app from scratch. blaine@blaine-laptop ~/tmp/rbjacolyte $ rake db:migrate (in /home/blaine/tmp/rbjacolyte) == AddHashToTrack: migrating ====...

undefined method 'link_to'

I'm writing a ruby-on-rails library module: module Facets class Facet attr_accessor :name, :display_name, :category, :group, :special ... URI = {:controller => 'wiki', :action => 'plants'} SEARCH = {:status => WikiLink::CURRENT} #Parameters is an hash of {:field => "1"} values def render_for_search(paramete...

Why wouldn't a specific environment override environment.rb in rails here?

I'm trying to work on a Rails site here in it's development environment, where I want to test email delivery, and I can't work out why properties declared in the main environment.rb aren't being overwritten by the more specific development.rb file that I presume would be loaded when booting a rails app. My understanding here is that val...

How to loop all the elements in the DB using RoR?

I use this to loop the products... <% form_for :product, @products, :url => { :action => "add_to_cart" } do |f| %> <%= product.title %> <%= product.price %> <%= submit_tag 'Make Order' %> <% end %> In my DB, I have product: title:abc price:874 title:cde price:98 title:efg price:18 but I can only get the efg 18.0 in my result, I m...

Ruby on Rails Win7 x64 ?

Hi, I've just upgraded to Win7 x64 Professional and wanted to recommence developing my Rails Apps, however I'm getting the following error : => Booting Mongrel => Rails 2.3.5 application starting on http://127.0.0.1:3344 D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_fra...

Why does Rails always display a datetime as 1/1/2000 - with the correct time

This one is driving me nuts!! The data is getting stored into the db (sqlite3) correctly. However, when I display the date from the record, Rails appears to coerce it to 1/1/2000 - with the correct time. In other words, if I specify this as the date time: December 31, 2009 6:00 PM, sqllite3 will in fact show 2009-12-31 18:00:00. But.... ...

Is There an Example of Using ActiveResource and XMLRPC for Rails?

I've seen a ton of examples with ActionWebService and XMLRPC, but they're 3 years old and from what I understand, ActiveResource is supposed to replace ActionWebService. I'm familiar with how ActiveResource can use XML to "talk" to other web sites and consume model information, but XML-RPC is a whole different type of thing, wherein you...

Should it be necessary to call ActiveRecord::Base.reload after updating a nested attribute collection?

I am finding (noodling around in script/console) that if I add a new item to the associated collection, I don't have to call foo.reload to see the resulting change: foo.bars => [] foo.bars_attributes = [{ :person_id => '288', :task_id => '1237' }] => [{ :person_id=>"288", :task_id=>"1237" }] foo.save => true foo.bars => [#<Bar id: 6, pe...

What's the deal with Rails' alter_table method?

I've been using sqlite3 for my database under development and my app has gotten complex enough that it's a bit slow to work with. I've just switched to MySQL and run rake db:create ; rake db:migrate and one of my migrations failed with the following error message: undefined method `alter_table` for #<ActiveRecord::ConnectionAdapters::M...

Does Rails support a neat way of listening to a UDP socket?

In Rails what would be the best way of integrating a UDP listening process that updated certain elements of the model (specifically its going to be adding rows to one of the tables). The simple answer seems to be start a thread with the UDP socket object within the same process, but its not clear quite where I should even do that which ...

vim settings in erb file

how can i apply vim settings to erb file?? like /* tabstop=4 shiftwidth=4 foldmethod=indent */ seems like <% # xxx %> # xxxx <!-- xxx --> didn't work ...

How to tell if rails is in production?

I used script/server -e production to start rails in production mode. It did and I got no errors. However how do I tell if it is in production mode? I tried a non-existent route, and I got a similar error page I did in development. I thought if under production model, I get the 404 error page that is in my /public folder. Does it mean...

Rails Ajax Form Disable Submit Button

I am having a little trouble figuring out how to disable the submit button in rails when a form is submitted. It works fine with javascript disabled and the ':disable_with' symbol in the 'remote_form_for#submit' function but cannot figure it out when submitting via ajax. Any thoughts? Using rails 2.3.5 and ruby 1.8.7. ...