Displaying 20 results from an estimated 30000 matches similar to: "Rails & .ejs.erb"
2011 Jun 17
0
.js.erb not being parsed by .erb first
I am trying to dynamically include a javascript file based on a
configuration option however I keep getting this error:
Error compiling asset application.js:
ArgumentError: wrong number of arguments (3 for 1)
(in c:/Users/Dieter/Documents/event_calendar/vendor/assets/javascripts/event_calendar.js.erb:1)
when trying to run this code:
//<% require ''event_calendar'' %>
//=
2012 Nov 21
0
What to use //= require_tree or js,css incude tag in application.erb ?
Hi ,
We are using reqiure_tree in our application.js and application.css.
As per i know require_tree include all js and css in application.js and
application.css .
We include application file of both .js and .css in our application.erb.
Q . We include both .js and .css application file in application.erb .
Is including in application.erb, did all .js and .css file are
included in
2012 Nov 27
1
controller not rendering existing js.erb file
In my PlaceController, I have a search method, called remotely from a form
the method is executed, but rendering is not executed as the template is
stated as missing ..
but it''s there ...
post :search, :locale => I18n.locale, :format => :js, :country =>
"United"
Error: test_should_search_places(Backoffice::PlacesControllerTest)
ActionView::MissingTemplate:
2011 Oct 12
4
How to access controller's instance variable in a js.erb loaded by javascript_include_tag?
Hello!
In rails 3.1 app I have a controller UsersController with ''show'' action.
show.html.erb contains:
<% content_for(:head) do %>
<%= javascript_include_tag ''myscript'' %>
<% end %>
<p>Hello @user.name</p>
And I have this in myscript.js.erb
$jQuery(document).ready(function() {
alert(<%= @user.name %>);
});
@user is being
2008 Nov 18
1
Missing js.erb template
Dear all
I am new to web development, and I am working on some simple ajax
function and got the following error that may need your expert opinions.
Missing template ecpath_app_version/__version_list.js.erb in view path
D:/Ruby/test/ssc_1/app/views
I know there is no js.erb file in app/view/<controller> folder, and I
don''t know what content should be in the js.erb. Are there any
2011 Mar 09
1
" instead of " in js code rendered by erb
Having problems rendering javascript in erb file. Thanks for
suggestions.
//layout erb file
(function() {
...
var widget_properties = {};
<%= content_for?(:extend_widget) ? "widget_properties = " +
yield(:extend_widget) : '''' %>
...
})();
//view erb file
<% content_for :extend_widget do %>
extend = {
_init: function() {
2012 Sep 23
0
serving .ejs files from rails?
I feel like an idiot for not being able to figure this out, but here goes.
I use the ''ejs'' gem to create ejs template files. My
assets/javascripts/foo.jst.ejs file is served up as
localhost:3000/assets/foo and assets/foo.js, but
localhost:3000/assets/foo.ejs gives a routing error. I have some framework
code that insists on calling it with the .ejs extension.
Do I configure
2010 Jun 24
0
Rails3: render_to_string of a .html.erb when request is a json request raises MissingTemplate error
I''ve the following situation (which actually works in Rails 2.3.8 and
this is a result of the migration of our app to rails3):
I have a partial which is rendered a few times (imagine tr''s in a
table). On the clientside there''s a script that does a json request
for a specific row (jQuery + ajax dataType: ''json'' and type: ''POST'')
In
2008 Jan 15
0
Namespaced routes and js.erb
Whenever I try and use a .js.erb view in my nested routes it tries to
look for a layout(i.e. admin.js.erb). any ideas on how to stop this
other than calling :layout => false?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2008 Jun 13
1
asset_host and ssl pages problem
I am configuring assets hosts for our site but am running into problems
when navigating to an https page. Basically the server is trying to pull
the assests out on https:// rather than http:/ but i do not have https
configured on the assets server. I have dug around a bit and found this
bit of code which should when a page is https:// serve the assests from
the app server and when it is not https
2010 Aug 16
8
Executing js.erb file with :format =>'js'
Hi, I''m trying to get my javascript to execute after clicking a link on
my page using :format => "js" here''s my link:
<%= link_to image_tag("/images/icons/user_add.png"),
add_contact_path(:profile_id => profile.id, :url => request.url, :format
=> "js"), :title => "Add person to your contacts"%>
in my controller i have
2006 Mar 12
0
ERB and Builder template engines shouldn''t be so heavily wired in ActionView::Base
Problem:
1. ERB and Builder template engines are heavily wired in ActionView::Base
2. Should be optional. If we use different engine - why load all their
stuff if not needed?
3. There are template engines which expect files in their own locations
and cache them in their own way. For instance a template engine may
store templates in a database. These engines don''t need any central
source
2006 Jun 27
5
Can''t call public application.rb method from ERb template
All,
I have a left navigation partial that I want to dynamically generate CSS
classes for based on the current controller action.
In my ERb template, I have
<DIV class="<%= get_menu_display_style(''login_form'') %>">
In application.rb, I have the method get_menu_display_style defined as:
public
def get_menu_display_style(action_requested)
2010 Jul 12
1
newbie: what is preferred approach for including javascript files?
Hi,
What is the cost of not cacheing javascript? If that cost is serious,
do I prefer to selectively include javascript files only for view
where they are needed? In other words I see four options:
1) Cache everything in layouts/application.html.erb and don''t worry
about selective inclusion of .js files where they are needed;
2) cache some things in (e.g., dependencies like jquery) and
2007 Jan 19
4
Rendering with erb
Hi, I thought it would be fun to try to write a render method that
uses erb for rending. I''m not much of a programmer, but I still like
to try:
module Test
require ''erb''
def render(m)
ERB.new(IO.read("templates/layout.html")).result(binding) do
ERB.new(IO.read("templates/#{m}.html")).result(binding)
end
end
end
This
2009 Mar 03
2
javascript file structure
hi
as far as i know (i''m new on ror) the file structure of javascript files
are:
app/views/posts/...
public/javascripts/*.js
what i understand as a View is final step of the application, the thing
that user see, let''s say...the screen. in this sense, javascript in
some cases, are also -part of- the "view" for some situations.
so, i understand that public/javascript
2011 Nov 10
1
url helper in model.js.erb.cofee (Sprockets::Context)
hello,
I am writing a js/coffee file that gets erb handling and I need to use
a url helper inside this file
if write
..
url: ''<%= url_for(:action => :index) %>''
I get an error:
NoMethodError Exception: undefined method `url_for'' for #<#<Class:
0xbdbb068>:0xeed1eb8>
>>self.class
#<Class:0xbdbb068> < Sprockets::Context
How do I
2012 Feb 17
0
Passing a value to js.erb
Rails 3.1.3
I''m trying to pass a value to ''save.js.erb'' .
in the view, I have put
<%= hidden_field_tag "video-id", @video.id, { :id => "video-id" } %>
then, I can retrieve it by
var idval = $(''#video-id'').val();
It certainly gets the value.
The problem is then I need to pass it to the following.
I tried,
2011 May 25
0
Issues implementing jquery-form plugin for displaying image via an ajax call in my rails poc
Hello all,
I am trying to implement a POC wherein I can post a message + image and
get the same working via AJAX to display them both for each new entry
without the page reloading.
I am using a config of Ruby 1.8.7 and Rails 2.0.2 for project specific
purposes.. I am also using a pretty old paperclip commit from github for
this....I had to suit my proj config requirements mentioned previously..
2012 Mar 31
0
Missing Template Error on render_to_string - Rails 3.2.2
Hi,
I''m trying to execute some javascript in the browser after completing
my create action in the controller. Here''s how I''m doing it:
In my controller:
def create
# exectue some code
js = render_to_string(:layout => false, :template =>
"planned_meals/meal.js.coffee.erb")
render :js => js
end
Two questions:
1) Am I going about it the