Displaying 20 results from an estimated 8000 matches similar to: "respond_to and format"
2008 Sep 02
5
Appending a record to a table
Hi
I''m not too sure how best to explain this but here goes!
I am trying to write an appointment system. I have, through example,
just about got the dynamics correct. Even tried to play with some
table joins (and excuse me if I''ve used the incorrect terminlogy). But
no matter what I try I can''t seem to get the following code to work.
I have a cart filled with Treatment
2009 Sep 09
5
Newbie question: undefined method 'number_with_delimiter'(probably configuration problem)
Hi all:
i am using gem to insall rails 2.3.3 and using $rails myapp to
generate my application, but strangely i can''t use the number_helper
below is my env:
export RUBY_HOME=$HOME/ruby
export GEM_HOME=$HOME/gems
export RUBYLIB=$RUBY_HOME/lib:$RUBY_HOME/lib/ruby:$RUBY_HOME/lib/
site_ruby/1.8
export PATH=$HOME/gems/bin:$HOME/ruby/bin:
and:
$ locate number_helper.rb
2008 Sep 07
8
How do I make an API?
Hi!
I''m a new developer trying to get into Ruby on Rails. My team is
developing an iPhone application that wants to call our Ruby on Rails
web-end to store and retrieve data. I''ve looked on the web and in this
forum but the only things I could find were dealing with scaffolding,
which a) didn''t solve the problem clearly for me and b) we''re not
using
2010 Aug 21
1
Rendering a different Javascript file in respond_to
Hi everyone, I am stuck in an (apparently) simple problem.
In my event_controller I have the i_like_it action:
def i_like_it
@event = Event.find(params[:id])
... # logic
respond_to do |format|
format.js
end
end
In my case "i_like_it" is called with :method => PUT (it is an Ajax
call, "i_like_it.js.erb" will be returned as a script and it wil be
2007 Nov 26
1
transition form respond_to to provides
I really like the new mime type handler however I was trying to convert some
code and couldn''t figure out how.
My rails action was handle 2 formats, html and xml
respond_to do |format|
format.html # show.html.erb
format.xml do
if @account.active? && @account.valid_referer?(session[:referer])
render :xml => @account.to_xml(:except
2008 Mar 18
4
respond_to formats, fbml and fbjs
In my controllers I have a respond_to block for both fbml and fbjs.
I created the fbjs mime type in environment.rb:
Mime::Type.register "application/javascript", :fbjs
However, even if I specify fbjs in a parameter name format during AJAX
post requests, it is being overwritten by Rails or Facebooker as FBML.
I confirmed this by placing logger.debug params[:format] immediately
before
2008 Jun 24
2
wrong number of arguments (1 for 0) when using respond_to?
Trying to get an otherwise working app (in Rails 2.0.2) up to speed
with Rails 2.1.0 and Ruby 1.8.7, I have some broken code I can''t seem
to fix:
module Pathmaker
def self.append_features( base )
base.before_save do |model|
model.path = model.name.downcase.
gsub( /\ and\ /, ''-'' ).
gsub( /\ on\ /, ''-'' ).
2007 Sep 20
11
Proposed API change for respond_to
Ez (or someone) asked on #merb tonight whether respond_to was the
right API for
what it does. After some discussion and pasties, I offer the
following proposed
API for content negotiation and response format selection:
First, what does respond_to do right now? I see at as performing 3
distinct
operations:
1. parse params[:format] and the accepts header to find out what
format the
2012 Feb 20
1
respond_to format.json not being called
Hi all,
I''m submitting a form using jQuery, but in the respond_to block only the
format.html action is called.
This is the javascrip:
send_button.on(''click'', function(){
var form = $(this).closest(''.modal'').find(''form'');
$.post(''/messages'', form.serialize(),
function(data, status, xhr){
2007 Jan 20
0
Best way to force a respond_to format
I am playing around with the idea of adding to the HTTP_ACCEPT header
method and trying to utilize WURFL for detecting mobile devices by
USER_AGENT instead. I''m thinking I will set up some kind of
before_filter in my controller, to intercept all requests and compare
the USER_AGENT to some data source.
If I detect that the USER_AGENT is a mobile device, then I''d like to
force a
2008 Sep 02
6
Writing new controllers
I have created new rails-project.
I start Mongrel.
I add to project:
app/controllers/my_first_controller.rb
---------------------------------------------------------
class MyFirstController < ApplicationController
def index
render :text => ''<html><body>My First Controller</body></html>''
end
end
http://192.168.1.1:8080/my_first/ -> all
2018 Sep 24
4
Writing simple intrinsic in clang
I want to write a simple backend-specific instrinsic that will just call an
instruction. How should I do that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180924/7faeeb3d/attachment.html>
2011 Jan 22
1
uninitialized constant ActionView::Helpers::TagHelper::ERB (NameError)
I am a new to ruby and rails and am trying to refactor some code with
rspec and have run into a problem that has stumped me for a few days and
I have searched google and ruby/rails forums to no avail so I really
hope somebody can help me out with this problem which I think may be
caused by a rails config problem. Anyway, I used ''rails new myapp'' to
make a new rails project and
2018 Sep 27
3
How to cross-compile for ARC in clang?
Oh, that's what I was afraid of.
So there is definetly no way to compile for ARC?
If so, should I write ARC.h(.cpp) in lib/Basic/Targets in order to make it
work?
чт, 27 сент. 2018 г. в 14:47, Tim Northover <t.p.northover at gmail.com>:
> Hi,
>
> On Thu, 27 Sep 2018 at 12:41, Павел Безбородов via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > clang -target
2012 Jun 08
1
[Rails 3.2.5] Rails: unit test fixture_path : fixture_file_upload cannot find the file ...
I am trying to perform a test unit, using FactoryGirl
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :article do
.......
photo { fixture_file_upload ''/files/test.jpg'', ''image/jpg'' }
end
end
IN mt test_helper.rb I defined the fixture_path
def fixture_path
File.dirname(__FILE__) + "/fixtures/" #
2018 Sep 27
4
How to cross-compile for ARC in clang?
Hello everyone,
I'm trying to compile my test.cpp for ARC, using this guide
https://clang.llvm.org/docs/CrossCompilation.html.
I've built my LLVM+CLANG with ARC, ARM and X86.
clang -target arc -S test.cpp
Gives me:
error: unknown target triple 'arc', please use -triple or -arch
clang -targer arm works fine
Is there any way to compile for ARC?
-------------- next part
2012 Nov 05
2
[PATCH] x86/ACPI: invalidate BGRT
Since the image pointed to may (and generally will) live in boot
services memory (which we add to the global memory pool long before
ACPI tables get looked at), we should prevent Dom0 from trying to
retrieve the image data.
The alternatives would be to
- not add boot services memory to the global pool at all, or
- defer adding boot services memory until Dom0 indicates it is safe to
do so, or
-
2009 Nov 08
2
send_data with jpeg not working
I''m a newbie having trouble using send_data to send a jpeg file to the
browser for display in an html img tag. This is the relevant code
from my controller (photos_controller.rb):
def retrieve
@photo = Photo.find(params[:id])
send_data File.read(@photo.abs_img_path), :type => "image/
jpeg", :disposition => "inline"
end
def download
@photo =
2008 Apr 20
1
Why is respond_to always rending the RXML view?
I''m having a problem in Rails 2 where respond_to is always rendering the
RXML view even in the HTML rendering response. Can anyone tell me why
this might be happening? Here''s a code snippet:
respond_to do |accepts|
accepts.html
accepts.xml { render :action => ''show.rxml'', :layout => false}
end
If I change this to the following it works fine:
2006 Apr 08
2
respond_to causes DoubleRenderError?
I have a custom authentication plugin that redirects users to a login
site if they aren''t already authenticated and their session hasn''t
timed out. I had things working fine with straight http requests, but
wanted to add support for ajax requests. I thought this would be a
simple matter of replacing all of my "redirect_to <blah> and return
false" calls with