How can I see a list of method parameters similar to how you can see methods for a Model/object like:
>> nil.methods
=> ["returning", "inspect", "with_options", "tap", .....
So that I can do:
>> nil.returning.attributes
=> some array or hash
I know I can look up in the code, but sometimes it's just faster for the console
...
To include a Rails helper, helper :helper_name and to include all helpers, helper :all is specified in the application_controller.
Now, how to include say N-1 of the available helpers? In other words, how to exclude a very few helpers?
...
I have a script using ActiveRecord that creates column names dynamically based on values read from a CSV file, something like this:
FasterCSV.foreach('votes.csv', :headers => true) do |row|
column_name = "roll_call_id_#{row['roll_call_id']}"
if !Legislator.columns.map(&:name).include?(column_name)
connection_pool.connection.add...
I'm always making the same steps when I do:
script/console
do you know some file to edit or something similiar to avoid doing always the same, like for example loading some particular required gem (in my casi 'spawners' :))
...
I am trying to build a free web application using ruby/rails It should be able to send sms through online forms of various mobile operators. (like this one (in russian)).
So, I need to
wait for the user, who wants to send an sms through my website.
establish connection to operator website. Probably, using Mechanize.
retrieve captcha
s...
I am new to Rails so this is probably an easy question but can't find anything that seems to explain it well.
How do I style forms in rails to. When I try to use the default styling for input (for example) it styles my text field and create button the same. Is there a built in convention or do I have to add some sort of helper. If it i...
I've been thinking about virtualizing part or all of my RoR development environment.
This could have, in theory, many advantages due to encapsulation
easily manage app-specific configurations
sandboxing gems and plugins dependencies
cross-platform
plug 'n play
virtualization commodities, like snapshots and so on
separation of conc...
What is the best way to create a hide and show effect in rails 2. Is it to use a JQuery type solution or is there something as good, better or easier built in?
...
I changed the highlightColor and highlightEndColor in the /public/javascript/controls.js file but it isn't changing when the AJAX effect runs. What am I doing wrong?
...
I have a rails model that needs an attribute that can have a value of either serial or parallel, what would be the correct name for this attribute?
...
I'm using the Rails session to store a cookie_jar I get from Mechanize. This lets me call a webservice and maintain the cookies it sends back.
The class takes a session in it's constructor, so I'm passing in the Rails session. Then, when I call the service, I load the cookie_jar (if I have one) like:
agent = WWW::Mechanize.new
agent.c...
Given a model like:
class PhoneNumber < ActiveRecord::Base
has_many :personal_phone_numbers
has_many :household_phone_numbers
has_many :organization_phones
has_many :people, :through => :personal_phone_numbers
has_many :households, :through => :household_phone_numbers
has_many :organizations, :through => :organization_phone...
So I just made a change password form for my rails app. It's just like any other very typical password change form.
So after a few times testing it out I started seeing a popup box saying
"Please confirm which user you are changing the password for"
Now this really freaked me out a bit since I know I did not write any code to do such ...
I'm looking to create a custom daemon that will run various database tasks such as delaying mailings and user notifications (each notice is a separate row in the notifications table). I don't want to use script/runner or rake to do these tasks because it is possible that some of the tasks only require the create of one or two database ro...
I have a site listing many jobs, but I also want each account to be able to access its jobs in one place. Thus, I am using these routes:
map.resources :jobs
map.resource :account, :has_many => :jobs
This gets me URLs like localhost/jobs/ and localhost/account/jobs. However, both seem to render JobsController::index. How can I either m...
All i want to do is display my joined tables user and products to a view.
my code in site controller looks like this:
def receive_drop
@user = User.find_by_id(session[:user_id])
@user.product << @product1
render products_users.find(:all)
end
i should probably because of the specific nature of receive_drop, have to save pro...
In my rails project, I have a query which finds the 10 most recent contests and orders by their associated poll dates:
@contests = Contest.find(
:all,
:limit => "10",
:include => :polls,
:order => "polls.start_date DESC" )
Currently this shows each contest and then iterates through associated polls sorting the master list by poll s...
I was having a really odd problem in my cucumber tests that was causing scenarios that were passing individually, to fail when run with others in a feature. I deduced this was a MySQL related issue and sure enough, a co-worker came along and recommended I change my connection pool to a higher value in my database config. Lo' and behold, ...
hi i have this :
<% for item in @ventas_ocurridas_en_este_periodo do %>
<% @pid = item.producto_id %>
<br/>
Producto: <%= Producto.find_by_id(@pid) %><br/>
Costo de Compra: <%= @costo_de_compra = Producto.find(:all, :conditions => "id = '#{@pid}'").*.costo_de_compra %><br/>
Precio de venta: <%= @precio_de_venta = item.precio_de_venta ...
I am trying to figure out how to add search to my rails application. I am brand new so go slow. I have created a blog and done quite a bit of customizing including adding some AJAX, pretty proud of myself so far. I am having trouble finding any good tutorials about how to add this functionality. Basically I just want to enable a full sea...