Displaying 20 results from an estimated 8000 matches similar to: "SEARCHING w JOIN in one-to-ma,y relationship"
2006 Oct 31
3
ActionMailer how to check mail sent
OS X 10.4.8
I am sending an email via Actionmailer
settings are written correctly in environment.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.raise_delivery_errors = :true
ActionMailer::Base.perform_deliveries = :true
ActionMailer::Base.default_charset = "utf-8"
ActionMailer::Base.server_settings = {
:address => "mail.mydomain.com",
:port => 25,
2007 Jun 26
3
what is the :or parameter in a submit_tag ?
I read the following tag in teh Beast example
<%= submit_tag''Login'', :or => link_to_function(''forgotten password'',
"$(''reset-password'').toggle();") %>
I understand the link_to_function, but what is this :or parameter used
for ?
the link doesn''t appear, so it cannot be used...
thanks for your lights
kad
--
2006 Aug 04
3
<img onclick> vs link_to_remote()
In one of my view , I have an image the user need to click to close a
<div>selections</div> added by an Ajax call.
if I use :
<img src ="/images/icon_closeitem.gif", size="16*16",
border="0",alt="Close Selection", title="Close", onclick="<%=
remote_function(:url => { :controller => ''property'',
2006 Aug 13
1
select include_blank true
Is there any way to display a default message value ''Select'' rather tha
an empty value when using this option ?
kad
--
Posted via http://www.ruby-forum.com/.
2006 May 14
4
searching on foreing keys
Hey all,
I''m using a simple search function. It''s working
great except for foreign keys.
I have one table pets (id,name,owner_id)
and another table people(id,name)
owner_id being a foreign key of pet pointing to people name.
here it is on the pet controller:
@paginator, @pets= paginate(:pets, :conditions =>["name OR owner_id
like
2007 Jul 02
3
stupid Rails rendering
I dont'' understand why it''s not possible to have a conditional
redirection in rendering
respond_to do |format|
format.js {
render :update do |page|
page.redirect_to posts_url if @located
page.replace_html ''error_message'', "Error..."
page << "$(''popup_error'').popup.show();"
2006 Sep 11
0
Print action to send body content to pdf-writer , which stra
I would like to give the user to execute an :action => ''print'' to get
a pdf version of the current content in the displayed page (rendered by
an :action =>''list''
I installed pdf-writer and played with it, but I don''t know how to give
him the @content he needs...
shoudl I re-execute all the list action before rendering ?
or use Ajax to get
2007 May 10
13
REST own action
I can sent my own action to a users_controller stating in routes.rb
map.resources :users, :member => { :network => get }
I defined in my users_controller the network action....
so I can have an url like
"http://localhost:3000/users/168.xml;network"
now I would like to have another action network_plus which is a little
bit different fron the network..
sure, I can state another
2006 Aug 12
0
select in form_remote_for
I am trying to use a slect box in my form, but I am stuck with an error
I cannot understand...
here is what I wrote according to the documentation ...
<%= f.select ("property", "user_id", User.find_all.collect {|u| [
u.name u.id ] }, { :include_blank => true }) %>
user_id is a FK to a user (owner of the property)
Associations : User has_many properties,
2006 Oct 14
2
sending parameters with link_to_remote Ajax Request
In a panel, I have an hidden input field which is modified by a
javascript function (from calendar)
how can I sent the value of this input field in my link_to_remote call ?
presently I just send back one parameter (an id) but I need both...
<input type="hidden" name="booking[start_at]" id="f_date_s"
value="booking[start_at]" />
...
<%=
2007 Jan 20
2
find_by_sql with named parameterized sql
I tried to use named parameters in my SQL query , using find_by_sql
Order.find_by_sql ([select * from orders where amount > ? and quantity >
?", [ @amount, @quantity ] works;..
but
Order.find_by_sql ([select * from orders where amount > :amount and
quantity > :quantity ", [ :amount => @amt, :quantity => @qty ] is not
working
a I wrong or should I use a plain select
2007 Jun 12
3
REST Routing issue
If I use http://0.0.0.0:3000/users/25/messages/new
I can create a new message ressource for user 25 that''s OK....
I would like to be able to use such url :
http://0.0.0.0:3000/users/25/messages;send?to=5
in order to create a new message from user 25 for a specific receiver
how should write my route ? I tried....
map.resources :users do |users|
users.resources :messages,
2007 Dec 22
8
Rails 2.0 rescue_from
I am trying to use the new Rails 2.0 macro : rescue_from
class PostsController < ApplicationController
rescue_from ActiveRecord::RecordNotFound, :with => :deny_access
...
def show
@post = Post.find_by_id(params[:id])
raise ActiveRecord::RecordNotFound if @post.nil? #illegal access
.....
end
def deny_access
respond_to do |format|
format.html
end
end
but the
2007 Jun 30
2
REST Route how to avoid hacking routes
what''s the best protection against someone trying to modify an URL in a
named route
/users/25/posts
if the user enter another URL /users/26/posts, he can get acces to user
26 posts unless ..
a before_filter is checking the current_user ID
but is there any other way to do it ?
thanks for your lights
kad
--
Posted via http://www.ruby-forum.com/.
2007 Feb 25
1
Relationships question (?)
Hello there,
Im currently taking a Senior Design Course at my college. We are
developing an online document editor prototype with Rails.
I am not well-versed in Rails. As a matter of fact, we chose it for the
project in order to learn it.
The problem we have is the following:
We have a User model (id, username, password, email) and we have a
Document model (id, name, content, owner_id). A
2007 Sep 08
1
Unknown Action doesn't raise exception ?
As I am in development environment, I wrote in my config/environment.rb
ActionController::Base.consider_all_requests_local = false
in my application.rb, I wrote
def rescue_action_in_public(exception)
case exception
when RoutingError, UnknownAction
render :file => "#{RAILS_ROOT}/public/404.html", :status =>
404
else
logger.error
2007 Jan 31
1
RJS collection proxy
I would like to update the class of all <a> tags found in a div of my
page..
I can get it all (seeing the index and value) using :
page.select("#header_domain_map a").each do |value, index|
page << ''alert(value);''
end
but how can I set the classof all these elements to class="active"
tfyl
kad
--
Posted via http://www.ruby-forum.com/.
2006 Oct 03
1
line too long in editor... (textmate)
my where :condition string line is too long in my editor, (Textmate...)
if I do a LR, I got a \n in my string, how can i get it displayed in
multilines without this garbage in the string :
here is the kind of string I am manipulating
cond_a.append ["(bookings.start_at == ? OR bookings.end_at == ? ) OR
(bookings.start_at <= ? AND bookings.end_at >= ? )",
2006 Sep 06
3
url_for , controller routing error
I have an ''account_controller.rb'' in an ''admin'' module
I list the accounts with : http://0.0.0.0:3000/admin/accounts/list,
and get my table
trying to sort it, I use the follwoing sort_link_helper :
def sort_link_helper(text, param)
key = param
key += "_reverse" if @params[:sort] == param
options = {
:url =>
2009 Oct 08
6
Eager Loading a Relationship That Has No PK/FK
I''m attempting to wrestle an old DB into Rails.
This relationship is giving me trouble:
class Show < AR::Base
has_many :segments
end
class Segment < AR::Base
belongs_to :show
has_one :media #this has no PK/FK relation
end
A Segment is "linked" to Media by Media.name, which is the result of
concatenating Segment.name and Segment.part. As I said there are is no