Displaying 20 results from an estimated 1000 matches similar to: "access controller var within model"
2006 Feb 01
1
distance_of_time_in_words_to_now with "ago" suffix
I wanted the distance_of_time_in_words_to_now method to have '' ago''
suffixed to it when the date is in the past, I assumed this would be the
default behaviour but apparently not. I know of a REALLY messy way that
i could solve this with, but it''s so ugly I can''t be bothered
Does anybody have an easy, elegant solution?
2006 Feb 08
3
ungenerate / remove scaffold command?
I have seen this somewhere and can''t find it now. Is there an ungenerate
or remove command for the scaffold generator. It would be easier than
removing all the files by hand.
I have tried ./script/ungenerate but no luck.
Thanks
--
Posted via http://www.ruby-forum.com/.
2006 Jun 26
2
DRY up selects in view
Here''s what I''ve got:
<% @fields.each do |field_name| %>
<tr>
<td>
<%= field_name.humanize %>
</td>
<td>
<% unless field_name =~ /_id$/ %>
<%= form.text_field field_name, :size => 40 %>
<% else %>
<%= select(:vendor,
field_name,
State.find(:all, :order
2006 Jan 13
1
Accessing file_column_helper from withing controller
Hi All,
i have i niggly little showstopper -> I need to access
file_column_helper from within the controller, as I need to include an
image in my "pdf-write" code...
Any sane way to do this?
"Require ''rails_file_column''" still gives me an error: "undefined method
`url_for_file_column''..." (I am using *svn* version with Rails 1.0)
2010 Jul 26
1
form date helper with text year
I have a date where the year range is more then I want to define in a
select_date scaffold generated year range.
My idea was to have the year entered as a text field and the month and
day using something like:
<%= select_month @person.born,:prefix => :person ,:field_name =>
"born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name =>
2006 Feb 02
1
tricky form validation
Hi list,
I want to create a form validation in my Marketing Model.
I want to raise an error only if a previous marketing campaign for a
property has not been completed (ie. ended_on IS NULL)
I managed to get this working in the Controller using something this:
...
if Marketing.count("property_id = #{@marketing.property_id} AND ended_on
IS NULL") > 0
...
However I assume
2015 Jun 20
1
Xapian with Json
Hi !
I?m newbie with Xapian !
I?m looking for the best way to index json data to be able to search by name/value pair and Full Text Search using only Xapian.
I did haven?t success to found a complete or a good documentation about json index and search.
Do you know some documentation about ?
Another problem that I have is that: In the same name/value pair sometimes I have different data types
2006 Feb 01
2
Getting Started with Site Redesign and RoR
Hello all:
I am in the process of redesigning my site and was thinking about
incorporating RoR into the overall structure. However, there are
multiple things I would like to create with Rails, namely a gallery, a
weblog, and portfolio management system. Given that I am going to be
using a lot of RoR, what is the best way to accomplish this task? Here
are some random things that have come
2006 Oct 05
4
search results autocompletion
Dear list,
I ''m using a text input field with autocompletion . The suggestions come
from a ferret index which is created by getting all the terms belonging to
other indices. Here is the code:
class Suggestion
attr_accessor :term
def self.index(create)
[Person, Project, Orgunit].each{|kl|
terms = self.all_terms(kl)
terms.each{|term|
suggestion =
2006 Apr 27
3
collection_select to display 2 fields
I''m trying to get a collection_select generated Drop-down box to display
two fields from a table (first name & last name); however, I am having
trouble concatenating the symbols. It appears as though any code I put
in the 5th argument for collection_select is processed prior to
executing the collection_select method. The code executes successfully
with 1 symbol in the 5th
2006 Mar 10
5
case insensitive search
I am having trouble with a simple gallery search.
I type in a segment of the address and i only
seem to be getting results if I use the correct case.
This is in my Gallery controller:
def search
@gallery = Gallery.find(:all, :include => :property,
:conditions => "address LIKE ''%#{@params[:keywords]}%''")
end
On a different note:
I am having
2006 Mar 21
5
Getting a time select input
I''m having trouble workign out which ActionView DateHelpers to display a
time input for an ActiveRecord field of type :time.
I just want an hours input and a minuites input. I can get these with
time_select helper using :field_name and :prefix but it gives both hours
and miniutes the same name.
<%= select_time(Time.now, :prefix => "search", :field_name =>
2006 Feb 01
4
Locking out users from certain records/urls
I am using the standard login controller that ships with RoR to
authenticate users in my application. In my app, Users belong to
Clients, Clients have Projects that users are assigned to (stored in a
stakeholder table with user_id and project_id columns) , then each
project has a bunch of folders and assets (file uploads).
So currently I have urls that look like /project/show/12 etc. I want
2005 Dec 22
2
Accessing an instance variable by its name (as a string)
Hi (again!)
I have a function which gets passed the name of an instance variable,
and spits its out all nicely formatted.
Just wondering, how do i access the variable, when all i have is its
name stored as a string?
So far i''ve got this code, but it looks horrible. Is there a better way?
eval("@" << inst_var_name << "." << field_name <<
2013 Jun 16
3
Backend for Lucene format indexes-How to get doclength
Hi, all:
I have wrote a demo patch for Backend for Lucene format indexes, Lucene
version is 3.6.2.
http://lucene.apache.org/core/3_6_2/fileformats.html
Now, this demo patch just support the basic features in Lucene. Compound
File(.cfs/.cfe)?term vector(.tvx/.tvd/.tvf)
delete document(.del) are not supported, skip list in .fdx is not supported
too
example/quest.cc is used to test this demo.
2008 Nov 22
6
select_month post and params
Hi
why is that not working?
Controller-----------------------------------------------------
def bla
month = params[:month_select]
redirect_to :action => "index"
flash[:error_messages_for] = month.to_s
end
View----------------------------------------------------------
<%form_tag :action => "bla" do %>
<%= select_month(Date.today,
2015 Mar 05
0
[PATCH v3] fish: add journal-view command
Lets user view journald log from VM in a similar format as journalctl uses.
Makes virt-log use the same code as guestfish for journal-view.
Fixes RFE: journal reader in guestfish (RHBZ#988100)
---
cat/Makefile.am | 1 +
cat/log.c | 113 +-------------------------------
fish/Makefile.am | 1 +
fish/fish.h | 3 +
fish/journal.c | 178
2006 Feb 02
2
multiple ''render :partial'' in a helper ??
Hi all,
I''d like to move some view code to a helper but it doesn''t work because
I need to render two partials each time.
Q: Is it possible to do this with a helper?
Example:
-----------------
Before: In the view:
...
<% case controller.controller_name
when ''member'' %>
<%= render :partial => ''shared/member_menu''
2007 May 03
2
Custom analyzer weirdness with 0.11.3
Hi-
I was previously using 0.11.4, and I wrote my own analyzer. Everything
worked fine.
When I took the system to production, 0.11.4 starting failing updating
the index, complaining that files were missing. The failure always
happened on the same model document, and was completely reproducible.
This failure looked a lot like the one described at
http://www.ruby-forum.com/topic/104145.
I
2006 Feb 01
4
rails IDE
**hi I am just curious what IDE everybody uses to develop rails application.
I am using eclipse with RDT and RAD plugin. But for some reason kicking
debug session takes a lot of time. Do anyone experience this kind of
problem?
--
Rgds,
--Siva Jagadeesan
http://www.varcasa.com/
My First Rails Project. Powered by Typo and soon by RForum too
-------------- next part --------------
An HTML