So, it looks like overwrite_params is deprecated as of Rails 2.3.6. Is there a suitable workaround that is generally accepted as best-practice?
For example, I used to to be able to do the following (which I thought was quite useful):
url_for(:overwrite_params => {:page => 1})
I've seen the following solution mentioned online ... is ...
I would like my User model to sanitize some input before before save. For now some simple whitespace stripping will do.
So to avoid people registering with "Harry " and pretend to be "Harry", for example.
I assume it is a good idea to do this stripping before validation, so that the validates_uniqueness_of can avoid accidental duplicat...
I need to track user activity for a new project.
...
I am trying to use nokogiri to parse the following segment
<tr>
<th>Total Weight</th>
<td>< 1 g</td>
<td style="text-align: right">0 %</td>
</tr>
<tr><td class="skinny_black_bar" colspan="3"></td></tr>
However, I think the "<" sign in "< 1 g" is causing Nokogiri problems. Does anyone know any workarounds? Is there a...
I am using the thinking-sphinx plugin for a ruby on rails app. In testing and development, I have reindexed many, many times, sometimes against different databases, with the result that now all of my searches return an empty array. I don't believe this is related to the codebase, because other developers using the same code can get valid...
DHH recently stated that Rails3 is about to be in RC mode.
This announcement ironically coincides with me and a friend of mine starting a Rails application. At this point in the game, we were going to just go ahead and be early adopters of 3. However, as we're both fairly inexperienced in creating large web apps with Rails, 2 seems like...
Hi,
I'm still new to ruby on rails and web development so please bear with me:
I have two arrays
a1 = [1,2,3,4]
b1 = [7,6,5,4]
I want to alternate which array i'm using; switching between a1[] and b1[].
I'm currently trying to use the cycle() command to accomplish this.
<% @good_bad = [7,6,5,4,3,2,1] %>
<% @bad_good = [1,2,3,4,5,6...
I have a Timesheet model, a Run model, and an Athlete model.
class Timesheet < ActiveRecord::Base
has_many :runs, :dependent => :destroy
accepts_nested_attributes_for :runs
end
class Run < ActiveRecord::Base
belongs_to :timesheet
belongs_to :athlete
end
class Athlete < ActiveRecord::Base
has_many :runs
end
Runs are neste...
I feel like this will end in a facepalm moment but I've been banging on my head on it for too long.
I have a Rails seed.rb file that gets all the files from a specific directory creating a new object for each file and saving the file via Paperclip:
Dir["./**/*.jpg"].each do |f|
...
p = Picture.new
File.open(f, 'r') { |photo_file|...
I am using openflashchart in my website that generates multiple flash graphs for a certain model.
I am trying to figure out best way to present these multiple flashes in one page. I have tried slideshow plugins (the issue with them is that the next/previous type elements which are generally over the sliding content, stop working when t...
I am attempting to pass 2 classes to an element in a rails 3 application and having some issues with encoding.
<td class="edit">
<%= link_to 'Edit', edit_link_url(link, :class => 'edit_link ui') %><br />
<%= link_to 'Delete', link_url(link, :class =>'delete_link ui'), :confirm => 'Are you sure?', :method => :delete %>
</td>
c...
I'm trying to install teambox on ruby. I am running passenger and getting this error:
Permission denied - /root/.bundle/ruby/1.8/specifications
I tried the following
chown teambox directory to teambox user
chown /root/.bundle/ruby/1.8/specifications to teambox user.
Please help!
...
I am trying to use the JQuery cookie plugin in my project but I'm running into some trouble. Because I need to use the prototype library along with the JQuery library I used the JQuery.noConflict() method to assign $j as the JQuery alias. Unfortunately, even once I have loaded jquery.cookie.js into my page, $j.cookie('name','value') retu...
I'm having some difficulties with following facebook_tutorial on http://apps.facebook.com/facebooker_tutorial/ and
wonder if this plugin is still up to date with the current Facebook API? For example, I'm trying to send notification or post in news feed but get errors like 'Undefined method' however I do everything just like in tutorial....
I've created a model for an existing table using the following generator command:
script/generate model Group
The table in question have a different name, so I've changed the model to account for it.
set_table_name 'demandegroupe'
Then I've fired up the console to look if everything was working.
>> Group.all
[#<Group login: "XXXXX...
My ssh keys are definitely set up correctly, as I'm never prompted for the password when using ssh. But capistrano still asks for a password when deploying with cap deploy. It doesn't ask for the password when I setup with cap deploy:setup though, strangely enough. It would make the deployment cycle so much smoother without a password pr...
i am trying to validate a field depending on attributes from the associated model. looking at the code will make more sense (i hope)
class User < ActiveRecord::Base
has_and_belongs_to_many :user_groups
has_one :profile, :dependent => :destroy
accepts_nested_attributes_for :profile
validates_associated \
:profile,
:allo...
First of all you have to know I'm total Ruby noob :)
I installed git-commit-notifier (http://github.com/ilozka/git-commit-notifier) on my system (Ubuntu 10.04) and followed all the installation instructions but every time I push to my git repository I get this error message:
remote: Sending mail...
remote: /usr/lib/ruby/1.8/net/smtp.r...
i am trying to use form data outside of just form elements. i want to show form data as normal text.
controller:
@addresses = ['Billing', 'Shipping']
@addresses.each do |a|
addresses.build(:address_type => a)
end
then within my form...for example...(haml)
- fields_for :addresses do |a|
a.address_type #to just render 'Billing...
I need to supply data from my Ruby on Rails database to a jquery grid plugin. At the moment, I'm doing it like this:
@notes = current_user.notes.all
respond_to do |format|
format.xml { render :xml => @notes }
end
But I only want to display certain fields in the grid, so I need to change the code to only send specified fields from t...