Hi,
I have an input field that captures a date in my form
<%= f.text_field :from_date, :style => 'width:80px;' %>
The user enters the date in the following format MM/DD/YYYY. However, when there is a validation error in the model and the form is displayed back to the user with the entered values, the date format is converted to YYYY-...
I try to submit a form by Mechanize, however, I am not sure how to add necessary form valuables which are done by some Javascript. Since Mechanize does not support Javascript yet, and so I try to add the variables manually.
The form source:
<form name="aspnetForm" method="post" action="list.aspx" language="javascript" onkeypress="javas...
My model class is:
class Category < ActiveRecord::Base
acts_as_nested_set
has_many :children, :foreign_key => "parent_id", :class_name => 'Category'
belongs_to :parent, :foreign_key => "parent_id", :class_name => 'Category'
def to_param
slug
end
end
Is it possible to have such recursive route like this:
/root_category...
I am dynamically generating textboxes in ruby using
<%0.upto(4) do |i| %>
<%= text_field_tag('relative_factor[]', @prefill_values[:relative_factor][i],:size => 6,:maxlength => 5) %>
<%end%>
it generates following HTML markup
Another set of textboxes:
<%0.upto(4) do |i| %>
<%= text_field_tag('rating_factor[]', @prefill_va...
I have this in my user.rb:
attr_accessor :old_password
def validate
unless password.nil?
errors.add_to_base("Old password entered incorrect") unless self.valid_password? old_password
end
end
I have old_password as a a virtual attribute that has to be validated as matching with the current before updating to a ne...
I'm integrating some non-rails-model tables in my Rails application. Everything works out very nicely, the way I set up the model is:
class Change < ActiveRecord::Base
establish_connection(ActiveRecord::Base.configurations["otherdb_#{RAILS_ENV}"])
set_table_name "change"
end
This way I can use the Change model for all existing re...
Hi All,
I have a page on which there is a link search.
onclicking search i open a LIGHTBOX where i get a textfield and Search button.
Now i want when i enter keyword in textfield and enter on submit button a result should be shown in a lighbox only.
is it possible w/o ajax or i have to use ajax form only.
just curious why we used get...
I've scaffolded Things element:
script/generate scaffold wip/thing name:string
and got some invalid function call in views, like:
<td><%= link_to 'Edit', edit_thing_path(thing) %></td>
Which raise this error:
ActionView::TemplateError (undefined method `edit_thing_path' for #<ActionView::Base:0xb5c00944>) on line #11 of app/views/...
[Rails] Where to put this code?
I have a user1 and when another registered user2 sees the profile of user1, has some buttons on it: ['add as friend', 'give me your number', 'give me your email', 'ask her out', 'view photos']. The 1,2,3,4 are POST, with AJAX. Now, i have to make a new controller named 'ProfileActionsController' or i shou...
Hi all,
I'm successfully using Paypal Express Checkout in a marketplace web app passing for every seller the three parameters to the PaypalExpressGateway (login, password and signature).
So, I see that Shopify lets the seller set only the e-mail address of the Paypal account requesting to grant scott_api1.jadedpixel.com as the API Par...
I'm trying to come closer to a solution for the problem of my previous question.
The scheme I would like to try is following:
User requests an action from RoR controller.
Action makes some database queries, makes some calculations, sets some session variable(s) and returns some RJS code as the response. This code could either
update ...
I love iPython and am learning RoR along with some libraries like Mechanize and I'd like to be able to easily see what I'm working with in terms of introspection. I would like to be able to type "." + TAB and see.
...
I have a newbie kind of question which I cant get my head around. How does the Proc in the if condition of the caches_action get executed for the caches_action method.
for example
caches_action :show, :if=>Proc.new{|x| something}
what i dont get its how does this get called.
I know i can execute a proc defined as
proc= Proc.new by...
I have been looking at integrating a search engine into rails, and I am considering both Sphinx with the Thinkink Sphinx plugin, or possibly Solr with the acts as solr plugin.
My question is which one works best in general? As far as I can see sphinx seems to be the option most people go with to get a basic search up and running.
...
Let's say I have two tables -- Products and Orders. For the sake of simplicity assume that only one product can be purchased at a time so there is no join table like order_items. So the relationship is that Product has many orders, and Order belongs to product. Therefore, product_id is a fk in the Order table.
The product table is ST...
Hello,
I need to make a collection with a lot of movies, but I was wondering if there is something like API or other method to make that database automatically? I will be using Ruby on Rails, but if there is a useful and fast tool, I will use it.
Thank you.
...
Hi, I am trying to get all users that are updated maximum 90 seconds ago:
User.find(:all, :include => { :core => :image },
:conditions => ["updated_at > ?", Time.now - 90.seconds] )
But it doesn't work.
why?
how can i do?
thanks
...
Hello,
I'm using the AtomFeedHelper and everything is working fine except for one feed where I need to link each entry to a URL which is not the default polymorphic_url for the record.
Per the documentation I've specified an :url option for the entry. This correctly renders a <url> tag in the atom node but the <link rel="alternate" sti...
I'm having trouble implementing this step:
Given "I am logged in as a Facebook user" do
end
The best suggestions I can find on the web (http://opensoul.org/2009/3/6/testing-facebook-with-cucumber) do not seem to be using Authlogic for authentication.
Can someone with the Cucumber/Authlogic_facebook_connect/Authlogic combo post thei...
I have a rails application that has multiple models with paperclip attachments that are all uploaded to S3. This app also has a large test suite that is run quite often. The downside with this is that a ton of files are uploaded to our S3 account on every test run, making the test suite run slowly. It also slows down development a bit,...