Displaying 20 results from an estimated 1000 matches similar to: "setting helper defaults"
2006 Jan 23
2
require rmagick
Hello,
I''m trying to use rmagick in a helper script (for auto-generating image sizes) and I''m not sure where I should be calling ''require''.
currently I have:
require ''RMagick'' at the top of my controller:
class FilmsController < ApplicationController
require ''RMagick''
but that''s giving me an error:
2006 Jan 18
1
using unique varchar instead of id
Hi,
I just signed up so ''hello everybody''.
As the title suggests, I was wondering if there was an easy way to specify that I want all actions/controls to be based upon a particular parameter rather than :id (in this case :unique_name). I don''t :id to appear in URLs or elsewhere, I want it all to work from :unique_name.
It seems like something that I should be able to
2006 Jan 25
1
deep inspecting attributes
Hi there,
in one of my templates I have the following code:
<% for film in @artist.films %>
<h3>films</h3>
<p><%= link_to film.title, :controller => ''films'', :action => ''showfilm'', :animate_title => film.animate_title, :page => ''synopsis'' %></p>
<% end %>
however if I do:
<%=
2006 Jan 19
3
template/variable confusion
Hi there,
I''m having some trouble working out where/when I can define template variables.
I have a standard.rhtml layout template which is used across the application as the main xhtml wrapper.
Inside there is some code like this:
<div id="<%= @layout_style %>">
<%= @content_for_layout %>
</div>
Now content_for_layout always works fine, but
2006 Jan 23
11
mysql dates
does anyone know of a way to make the date_helper deal with mysql dates with 00 values in them?
I have lots of dates that are like the following:
2005-04-00
2005-00-00
and I need to set null values in a date_select for elements that are 00. These are valid dates in mysql.
In the absence of an immediate solution to the above, I''ve been trying to find out how InstanceTag.new works so I can
2006 Jan 25
0
InstanceTag
Hi,
I''ve been prying my way around form helpers and I need to do something very similar to date_select. I was thinking I might be able tailor it to suit my purposes and then came upon InstanceTag.new with a call to_date_select_tag at the end.
I can''t find any mention of these anywhere else - can anyone give me any pointers as to what these two things do?
thanks dorian
--
I do
2006 Jan 26
0
setting default on "has_one" failure
Hi there,
I have a model for a Film, which:
has_and_belongs_to_many :artists
has_many :stills
has_one :preview_image,
:class_name => "Still",
:conditions => "priority=''main''"
the has_one:preview_image and has_many:stills obviously draw from the same table.
I was
2008 Jun 26
2
Problem with date_select after Rails 2.1 upgrade
Folks,
I think I should start a new thread for this, because a similar one I
saw is a bit old and the resolution there doesn''t seem to apply to
what I''m running into now.
Anyway, my date_select calls are bombing on me with the exception:
----
ActionView::TemplateError (wrong number of arguments (3 for 2)) on
line #8 of entries/_dates_form.haml:
8: = date_select(
2009 Jan 28
1
How to give onchange for select_year rails helper....
<%=select_year(Date.today,:include_blank=>true, :start_year =>
Date.today.strftime("%Y").to_i, :end_year => 1999)%>
i am using rhis helper... now i want to give onchange here....
Please help me to solve this ....
thanks in advance
JK
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because
2006 Jan 19
4
PHP ob_start in Ruby
I need to include Content-Length in each file. In PHP it would be:
<?php
ob_start();
?>
html
<?php
header(''Content-Length: '' . ob_get_length()); ob_end_flush();
?>
How can I do the same in Ruby?
Thanks,
eduard
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 May 24
2
named routes confusion
Hi,
I''m trying generate a URL from a named route like: namedroute_url(params...)
but the generated route is always coming out as the first match from the routes table.
The named route is defined inside a map.with_options block, but that shouldn''t matter should it?
dorian
--
--
I do things for love or money
2006 Nov 04
2
date_select parameter
Trying to add start year to date_select
<%= date_select(:start_year => 1980)%>
It''s throwing an exception "wrong number of arguments (1 for 0)
Can''t I add a start_year, API shows this option ?
TIA
Stuart
http://en.wikipedia.org/wiki/Dark_ambient
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
2006 Apr 28
2
tests and login_engine
Hi there,
I just started writing tests today after some months of using rails (slap wrists).
I seem to be getting the hang of things, but I''m hitting a wall when it comes to functional_testing pages protected by login_engine/user_engine.
all my assertions come back with:
Expected response to be a <:success>, but was <302>
Is there a way I can login from within a test?
2006 May 16
3
wondering how to do some clever DRYing up
Hi there,
I''m now getting to the point in my rails app where I can use all of the nice basic features like AJAX and engines etc...
but, I want to get my hands a bit dirtier, whilst learning to DRY up my code a bit.
I''m using AJAX quite a bit to dynamically populate/edit/sort has_many relationships in forms, and consequently on a model with many has_many''s I end up
2005 Dec 01
0
Problem using a date helper
Hi,
I''m having trouble getting a date helper working. I was pointed to
this by Sean Allen, and it resides at
http://theredheadedstepchild.net/articles/2005/08/04/datehelper-fixes
It''s meant to fix the bug in Rails which doesn''t allow datetime_select
to properly discard the year.
So, I''m trying to use the helper''s time_select function.
date_helper.rb
2006 Mar 15
1
Strange behaviour of dates
Imagine a crud app that tracks people applying for a loan, here is the
layout I have:
Mysql database:
create table apps (
id int auto_increment primary key,
primary_id int not null,
secondary_id int null,
constraint fk_primary_id foreign key(primary_id) references (contacts.id),
constraint fk_secondary_id foreign key(secondary_id) references
(contacts.id))
create table contacts (
Id int
2006 May 03
2
Using a helper within another helper?
I am trying to push some view logic into a helper. The thought is that
this is a step towards having the business logic in the helper rather
than the view. However, I''m essentially wrapping the checks around an
eventual call to date_select(). The problem I''m having is that the
application complains that it doesn''t know about date_select(). I''m
sure (or
2011 Feb 28
0
MultiDimensional arrays
hello,
I'm working with a 4 dimensional NetCDF file, trying to calculate some
summary statistics on a parameter.
The dimensions are number of rows and columns, time and days. The
attribute in question in this case happens
to be a probability of woodstork foraging success. But it could be anything
My question is whether the following code is efficient to grab the
probability values ? I am
2011 Mar 26
0
NetCDF - rolling means and StdDev
Hello,
I am trying to come up with a routine to calculate a rolling mean and
standard deviation for three parameters stored in a NetCDF file. The NetCDF
file contains 10 years of daily records for each of the three parameters,
and I need the statistics for each of the three parameters.
Below I include some code illustrating what I've done so far. Obviously this
approach does not get at the
2005 Oct 20
3
Missing id on date_select (0.14.1)
I''m getting markup violation errors on my tests and I noticed
that a template with this (a modified 0.13.1 generated scaffold).
<label for="credit_card_account">Account</label>
<%= text_field ''credit_card'', ''account'' %>
<label for="credit_card_expires_on">Expires on</label>