Hi,
I am trying to use Cucumber for a Rails project on Windows.
Unfortunately the time it takes to run a scenario is making BDD
impossible.
I understand this is largely due to the time taken by Rails to load up
under windows.
Does anyone have any ideas about how I can speed things up.
e.g Is it possible to call Cucumber inside a Rails c...
I am new to ruby development. Up until this point, I've done only small project that easily fit in one's head (and in one or two files). Now, I've got a big project (it's a GUI for a database task scheduler) that I need to make changes to. There are many files (879 to be precise) and I need a better way to get to know what's where.
...
I feel a bit like Edison in search of the elusive filament. I am still in search of the right fundamental design foundation for my web application.
I believe I have found a pattern to base it on and was hoping the community could suggest some strategies for implementing it.
I would like to mimic the iterative control flow of tax softw...
Consider the table creation script below:
create_table :foo do |t|
t.datetime :starts_at, :null => false
end
Is it's possible to set the default value as the current time?
I am trying to find a DB independent equivalent in rails for the SQL column definitions given below:
Oracle Syntax
start_at DATE DEFAULT SYSDATE()
MySQL Synt...
Anyone have experience with this plugin? I have it installed but I have no idea how to implement it. How do I define the different roles?
...
I recently changed machines, and had a few rough spots updating Rails. The server itself stayed as it was. Everything seemed to be fine, but not capistrano. When I make changes and update SVN, running
cap deploy
the correct new version of the repository is placed on the server. The logging in the terminal running capistrano shows not...
After restarting a Rails app in production environment and submitting a login form for the first time the application throws an "ActionController::InvalidAuthenticityToken" error.
After the first form submit everything works fine.
The application only logs the action and controller parameters for the first request: {"action"=>"create...
Say I have the following controller and want to restrict :edit, :update, and :destroy to current_user's own foos.
class FooController < InheritedResources::Base
before_filter :login_required
respond_to :html
def show
@foo = Foo.find params[:id]
show!
end
protected
def collection
@foos ||= Foo.all
end
def ...
Hi everyone,
I'm trying to group contents that belong on a same date together for display, such that the date only gets posted once and in chronological order.
Something like:
14th October 2009
Item 3
Item 3 content
Item 2
Item 2 content
13th October 2009
Item 1
Item 3 content
How can I display that in view? (Assume that @items is ...
How can I use RJS to modify CSS elements on a page? I'm looking to do modify the margin of a div to add a "margin-top: 2.8em;"
How can I access this with RJS or should i use something like
page << "document.getElementById('super-wrap').style.margin-top='2.8em;';"
Though this doesn't work.
Thanks
...
I have a model which contains many predefined rows (> 100) and also can be edited by the user.
I want to distinguish between pre-defined and user-added rows.
Because the database will be edited by a third-party application, too, I want to be on the safe side and set the default value for predefined to false in the database schema, becau...
I have a helper method that creates navigation links for some controllers.
def gen_associations(controllers)
content_for :leftnav do
sorted_controllers = controllers.sort
returning String.new do |content|
content << content_tag(:h3, "Associations") <<
content_tag(:ul, :class => "nav") do
sorte...
When I make a query...
is there any meaningful difference between using a find_by helper or not?
Are there any reasons I'm overlooking for opting for shorter lines of code when doing things like this?
Booking.find_all_by_user_id(1, :joins => :confirmation)
Booking.find(:all, :joins => :confirmation, :conditions => [ 'bookings.user_id...
I have this Rails model: (Parameters removed for clarity)
class Folder < ActiveRecord::Base
belongs_to :parent, :class_name => :folder
has_many :children, :class_name => :folder
end
I want this model to be used like a file system folder. How do I have to configure the routes and the controller to make this possible?
...
I am trying to chain a calendaer_date_select to a select field, so the select list is filtered by the choosen date. I have followed the instructions as described here
I have in the activescaffold config:
config.columns[:order_date].form_ui = :calendar_date_select
config.columns[:order_date].options = {:update_column => :sale}
config.co...
Hi,
the following code does work under my Windows development environment, but not on my production Linux/Apache2/FastCGI env.
in my view rhtml file :
<td id='first_column' class='column'>
<% content_for :head do #DO NOT CACHE THIS content for : HEAD %>
<%= stylesheet_link_tag('live_tree') %>
<%= javascr...
I'm trying to update just one instance of a has_many relationship in a form, I'm relying on accepts_nested_attributes_for (which might be the problem).
This works, updating just one response instance on the responses relationship:
<% parent_form.fields_for(:responses) do |ff| %>
<%= eval("ff.#{question.field_type} :raw_response") if ...
Does anyone know of a gem or a good implementation of allowing the user to add fields to a model?
Ex.
User would like to add a "internal notes" field to the contact model. In the interface they would just select "New field" > "Type: Text"
Thanks
...
When working with a model, when do you need to explicitly save? Say in a setter
def name=(n)
self.name = n
end
Do I need a self.save?
...
I implemented a restfull controller with all the correct actions and views. It works currently perfectly with a new_html.erb view that uses a form_for containing a structure like:
<% form_for @ecard do |f| %>
when watching some tutorials i saw that people also use the structure:
<% form_for :ecard do |f| %>
It sounds logical.. but ...