Search Results

Search found 193 results on 8 pages for 'haml'.

Page 1/8 | 1 2 3 4 5 6 7 8  | Next Page >

  • Wierd Haml 3 error with ruby 1.9.1 and rails 3

    - by Micke
    I'm getting this wierd error on my windows 7 computer when i am using the html2haml command with Haml 3 and Rails on ruby 1.9: -- control frame ---------- c:0017 p:-9593720 s:0052 b:0052 l:000051 d:000051 TOP c:0016 p:---- s:0050 b:0050 l:000049 d:000049 CFUNC :require c:0015 p:0026 s:0046 b:0046 l:000045 d:000045 TOP C:/Ruby/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2-x86-mswin32/lib/hpricot.rb:20 c:0014 p:---- s:0044 b:0044 l:000043 d:000043 FINISH c:0013 p:---- s:0042 b:0042 l:000041 d:000041 CFUNC :require c:0012 p:0095 s:0038 b:0038 l:000037 d:000037 TOP C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/html.rb:101 c:0011 p:---- s:0036 b:0036 l:000035 d:000035 FINISH c:0010 p:---- s:0034 b:0034 l:000033 d:000033 CFUNC :require c:0009 p:0022 s:0030 b:0030 l:000029 d:000029 METHOD C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/exec.rb:559 c:0008 p:0050 s:0023 b:0023 l:000022 d:000022 METHOD C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/exec.rb:41 c:0007 p:0013 s:0020 b:0020 l:000019 d:000019 METHOD C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/exec.rb:22 c:0006 p:0078 s:0016 b:0016 l:000015 d:000015 TOP C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/bin/html2haml:7 c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load c:0003 p:0127 s:0007 b:0007 l:000e54 d:0020c0 EVAL C:/Ruby/bin/html2haml:19 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH c:0001 p:0000 s:0002 b:0002 l:000e54 d:000e54 TOP --------------------------- -- Ruby level backtrace information----------------------------------------- C:/Ruby/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2-x86-mswin32/lib/hpricot.rb:20:in `require' C:/Ruby/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2-x86-mswin32/lib/hpricot.rb:20:in `<top (required)>' C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/html.rb:101:in `require' C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/html.rb:101:in `<top (required)>' C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/exec.rb:559:in `require' C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/exec.rb:559:in `process_result' C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/exec.rb:41:in `parse' C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/lib/haml/exec.rb:22:in `parse!' C:/Ruby/lib/ruby/gems/1.9.1/gems/haml-3.0.0/bin/html2haml:7:in `<top (required)>' C:/Ruby/bin/html2haml:19:in `load' C:/Ruby/bin/html2haml:19:in `<main>' [NOTE] You may encounter a bug of Ruby interpreter. Bug reports are welcome. For details: http://www.ruby-lang.org/bugreport.html This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. And then ruby crashes. I have reinstalled all the gems but nothing will help. Please help me

    Read the article

  • Using HAML with custom filters

    - by Guard
    Hi everybody. I feel quite excited about HAML and CoffeeScript and am working on tutorial showing how to use them in non-Rails environment. So, haml has easy to use command-line utility haml input.haml output.html. And, what is great, there exist a project (one of many forks: https://github.com/aussiegeek/coffee-haml-filter) aimed at providing custom filter that converts CoffeeScript into JS inside of HAML files. Unfortunately (or am I missing something?) haml doesn't allow specifying custom filters on the command line or with some configuration file. I (not being a Ruby fan or even knowing it enough) managed to solve it (based on some clever suggestion somewhere on SO) with this helper script: haml.rb require 'rubygems' require 'active_support/core_ext/object/blank' require 'haml' require 'haml/filters/coffee' template = ARGV.length > 0 ? File.read(ARGV.shift) : STDIN.read haml_engine = Haml::Engine.new(template) file = ARGV.length > 0 ? File.open(ARGV.shift, 'w') : STDOUT file.write(haml_engine.render) file.close Which is quite straightforward, except of requires in the beginning. Now, the questions are: 1) should I really use it, or is there another way to have on-demand HAML to HTML compilation with custom filters? 2) What about HAML watch mode? It's great and convenient. I can, of course, create a polling script in python that will watch the directory changes and call this .rb script, but it looks like a dirty solution.

    Read the article

  • Refactoring an ERB Template to Haml

    - by Liam McLennan
    ERB is the default view templating system used by Ruby on Rails. Haml is an alternative templating system that uses whitespace to represent document structure. The example from the haml website shows the following equivalent markup: Haml ERB #profile .left.column #date= print_date #address= current_user.address .right.column #email= current_user.email #bio= current_user.bio <div id="profile"> <div class="left column"> <div id="date"><%= print_date %></div> <div id="address"><%= current_user.address %></div> </div> <div class="right column"> <div id="email"><%= current_user.email %></div> <div id="bio"><%= current_user.bio %></div> </div> </div> I like haml because it is concise and the significant whitespace makes it easy to see the structure at a glance. This post is about a ruby project but nhaml makes haml available for asp.net MVC also. The ERB Template Today I spent some time refactoring an ERB template to Haml. The template is called list.html.erb and its purpose is to render a list of tweets (twitter messages). <style> form { float: left; } </style> <h1>Tweets</h1> <table> <thead><tr><th></th><th>System</th><th>Human</th><th></th></tr></thead> <% @tweets.each do |tweet| %> <tr> <td><%= h(tweet['text']) %></td> <td><%= h(tweet['system_classification']) %></td> <td><%= h(tweet['human_classification']) %></td> <td><form action="/tweet/rate" method="post"> <%= token_tag %> <input type="submit" value="Positive"/> <input type="hidden" value="<%= tweet['id']%>" name="id" /> <input type="hidden" value="positive" name="rating" /> </form> <form action="/tweet/rate" method="post"> <%= token_tag %> <input type="submit" value="Neutral"/> <input type="hidden" value="<%= tweet['id']%>" name="id" /> <input type="hidden" value="neutral" name="rating" /> </form> <form action="/tweet/rate" method="post"> <%= token_tag %> <input type="submit" value="Negative"/> <input type="hidden" value="<%= tweet['id']%>" name="id" /> <input type="hidden" value="negative" name="rating" /> </form> </td> </tr> <% end %> </table> Haml Template: Take 1 My first step was to convert this page to a Haml template in place. Directly translating the ERB template to Haml resulted in: list.haml %style form {float: left;} %h1 Tweets %table %thead %tr %th %th System %th Human %th %tbody - @tweets.each do |tweet| %tr %td= tweet['text'] %td= tweet['system_classification'] %td= tweet['human_classification'] %td %form{ :action=>"/tweet/rate", :method=>"post"} = token_tag <input type="submit" value="Positive"/> <input type="hidden" value="positive" name="rating" /> %input{ :type=>"hidden", :value => tweet['id']} %form{ :action=>"/tweet/rate", :method=>"post"} = token_tag <input type="submit" value="Neutral"/> <input type="hidden" value="neutral" name="rating" /> %input{ :type=>"hidden", :value => tweet['id']} %form{ :action=>"/tweet/rate", :method=>"post"} = token_tag <input type="submit" value="Negative"/> <input type="hidden" value="negative" name="rating" /> %input{ :type=>"hidden", :value => tweet['id']} end I like this better already but I can go further. Haml Template: Take 2 The haml documentation says to avoid using iterators so I introduced a partial template (_tweet.haml) as the template to render a single tweet. _tweet.haml %tr %td= tweet['text'] %td= tweet['system_classification'] %td= tweet['human_classification'] %td %form{ :action=>"/tweet/rate", :method=>"post"} = token_tag <input type="submit" value="Positive"/> <input type="hidden" value="positive" name="rating" /> %input{ :type=>"hidden", :value => tweet['id']} %form{ :action=>"/tweet/rate", :method=>"post"} = token_tag <input type="submit" value="Neutral"/> <input type="hidden" value="neutral" name="rating" /> %input{ :type=>"hidden", :value => tweet['id']} %form{ :action=>"/tweet/rate", :method=>"post"} = token_tag <input type="submit" value="Negative"/> <input type="hidden" value="negative" name="rating" /> %input{ :type=>"hidden", :value => tweet['id']} and the list template is simplified to: list.haml %style form {float: left;} %h1 Tweets %table     %thead         %tr             %th             %th System             %th Human             %th     %tbody         = render(:partial => "tweet", :collection => @tweets) That is definitely an improvement, but then I noticed that _tweet.haml contains three form tags that are nearly identical.   Haml Template: Take 3 My first attempt, later aborted, was to use a helper to remove the duplication. A much better solution is to use another partial.  _rate_button.haml %form{ :action=>"/tweet/rate", :method=>"post"} = token_tag %input{ :type => "submit", :value => rate_button[:rating].capitalize } %input{ :type => "hidden", :value => rate_button[:rating], :name => 'rating' } %input{ :type => "hidden", :value => rate_button[:id], :name => 'id' } and the tweet template is now simpler: _tweet.haml %tr %td= tweet['text'] %td= tweet['system_classification'] %td= tweet['human_classification'] %td = render( :partial => 'rate_button', :object => {:rating=>'positive', :id=> tweet['id']}) = render( :partial => 'rate_button', :object => {:rating=>'neutral', :id=> tweet['id']}) = render( :partial => 'rate_button', :object => {:rating=>'negative', :id=> tweet['id']}) list.haml remains unchanged. Summary I am extremely happy with the switch. No doubt there are further improvements that I can make, but I feel like what I have now is clean and well factored.

    Read the article

  • Rails 2.3.2 trying to render ERB instead of HAML

    - by c00lryguy
    Rails is suddenly trying to render ERB instead of Haml and I can't figure out why. I've created new rails projects, reinstalled Haml, and reinstalled Rails. Here's exactly the steps I take when making my application (Rails 2.3.2): rails> rails test rails> cd test rails\test> haml --rails . rails\test> ruby script\generate model user email:string password:string rails\test> ruby script\generate controller users index rails\test> rake db:migrate Here's what the UsersController looks like: class UsersController < ApplicationController def index @users = User.all end end My routes: ActionController::Routing::Routes.draw do |map| map.resources :users end I now create views\users\index.html.haml: %table %th(style="text-align: left;") %h1 Users - for user in @users %tr %td= user.email %td= user.password Annnd run the server... I navigate to localhost:3000\users and I get this error message: Template is missing Missing template users/index.erb in view path app/views For some reason Rails is trying to find and render .erb files instead of .haml files. vendor\plugins\haml\init.rb exists, untouched. I've reinstalled Haml (Pretty Penny) multiple times and still get the same results. I've also tried adding config.gem 'haml' to my environment.rb but this also doesn't work. I can't figure out why suddenly rails will not render haml for me.

    Read the article

  • Haml Inherit Templates

    - by kjfletch
    I'm using Haml (Haml/Sass 3.0.9 - Classy Cassidy) stand-alone to generate static HTML. I want to create a shared layout template that all my other templates inherit. Layout.haml %html %head %title Test Template %body .Content Content.haml SOMEHOW INHERIT Layout.haml SOMEHOW Change the title of the page "My Content". %p This is my content To produce: Content.html <html> <head> <title>My Content</title> </head> <body> <div class="Content"> <p>This is my content</p> </div> </body> </html> But this doesn't seem possible. I have seen the use of rendering partials when using Haml with Rails but can't find any solution when using Haml stand-alone. Having to put the layout code in all of my templates would be a maintenance nightmare; so my question is how do I avoid doing this? Is there a standard way to solve this problem? Have I missed something fundamental?

    Read the article

  • haml with rails3 (git master) and devise: form_for syntax change breaks haml -- suggestions?

    - by z3cko
    i am trying to get haml working with a rails3 project; since i am quite far in the modeling i wanted to go to the haml views now -- seems that the current haml (git master) does not work together with the current rails3 git master because of some syntax changes in rails3 form_for does anyone have more information on the syntax changes? is there a temporary workaround to use haml with rails3? (i am on a deadline) :( see also: http://j.mp/9EYraQ thanks!

    Read the article

  • HAML on Rails 3 doesn`t work

    - by Peter
    Hey there, i have tried to render some files with HAML in Rails 3. But HAMl doesn`t work. My testfiles have the extension .html.haml. In the GEMFile i have written gem 'haml' and executed the bundle install When i call my testapp i become an error like this: Template is missing Missing template posts/index with {:locale=>[:en, :en], :formats=>[:html], :handlers=>[:rjs, :rhtml, :rxml, :builder, :erb]} in view paths "/Users/piet/Sites/blog/app/views" Hope, i become some help here. Peter

    Read the article

  • html.erb vs erb (and haml equivalents)

    - by mathee
    I'm not sure I understand the difference between the html.erb files and erb files in the views for a Ruby on Rails application. (Similarly for haml files.) What are the dis/advantages of each (html.erb/haml or erb/haml) files? PS I'm not asking about the difference between the erb and haml files -- just appending the extension to an html file versus not appending it.

    Read the article

  • How to escape HAML for Javascript in Sinatra

    - by viatropos
    I would like to return a list/combobox from an ajax request ("Which on of these do you like?" type thing). I would like to write that little snippet in HAML, which converts it to HTML, but when I do, the page goes blank. I'm assuming this is because the HTML isn't escaped. Is there a way to escape HAML so I can do $("#mydiv").html(response);? Here's the method: post "/something" do # process... haml :"partials/_select", :layout => false, :locals => {:collection => choices} end ... the haml template: %select - collection.each do |item| %option{:value => item.to_s}= item.to_s ... and the javascript: success: function(responseText, statusText, xhr, $form) { $(".dialog_content").append(responseText); } I have tried the sinatra_more plugin and the escape_javascript method, but there's problems with the haml buffer in sinatra. Any ideas?

    Read the article

  • Using Rails 3 and Haml 3, how do I configure Haml?

    - by dpogg1
    I'm using Rails 3.0.0.beta3 and Haml 3.0.0.rc.2, and I can't find where I need to place the configuration lines for Haml (nor what they are in the new version, for that matter). Using Rails 2.3.5 and Haml 2, I would do Haml::Template.options[:format] = :html5 in environment.rb. Or, in Sinatra, set :haml, {:format => :html5} in my main file. But in Rails 3 everything's been changed around, and no matter where I put that configuration line, I get an undefined method or undefined object error.

    Read the article

  • Compass, Haml alongside Sass installation took over ERB, need to reverse

    - by Nik
    Hi all, I've been trying out Compass for a few days now, and just now I ran into some strange problem: The past few days, as usual, whenever I use my textmate shortcut to create a partial if not already created, that partial will be created in .erb format, but then just now, a few minutes ago, I have no idea what I have done, when I tried to create a new partial, it is prompting me to create one that ends with .haml. when I didn't create that and manually created a .erb partial with all the code that was suppose to go in there, I tried to load the page that uses that partial, it says the partial is missing. That kind of tells me now Rails is looking for Haml templates instead of erb templates. That means all my other partials are useless. And indeed they have become!!! I don't know how this happened. It was working fine with ERB just minutes ago, and suddenly Haml took over and demand all partials be written in it. So my question: Can I keep both Haml and Erb in one Rails application and use mostly erb except for Sass/compass related files? Where in Rails does it state what templating format (erb | haml) it should use? Thanks!

    Read the article

  • Some questions about working with Haml

    - by damian
    I am trying to use Haml with Grails but I am having some issues. The plugin for haml has errors to parse empty lines. The plugin generate gsp files, so I think that I can use the online haml html generator. Bug I want something like an editor with syntax highlithing, blocks, etc, and that generate html. Is there something like this? Or only the editor? thanks in advance

    Read the article

  • HAML-like syntax for non-HTML documents?

    - by Peter
    I love using HAML for HTML documents. It has clean syntax that's much more attractive than ERB. It works perfectly for HTML documents. What about for non-HTML? Such as, for example, an email or text document with certain automatically-substituted components? I've been falling back to ERB, but don't like the heavy syntax compared to HAML. Is there any way to use HAML for ordinary documents without having divs and html elements appear when % and . start a line? Or is there some alternative to both HAML and ERB that I should investigate?

    Read the article

  • Having problems using haml and rails3

    - by Victor Rodrigues
    After installing rails3, I'm experiencing problems when trying to use haml with it. I have the updated gem installed, and after rails PROJECT_NAME , I did haml --rails in its root. It apparently had worked fine, since I have haml folder inside plugins, init.rb, as expected. But when I try to rake, or rails server, I get: rake aborted! no such file to load -- haml With --trace I get this: ** Invoke default (first_time) ** Invoke test (first_time) ** Execute test ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! no such file to load -- haml /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:537:in `new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require' RAILS_PROJECT_ROOT/vendor/plugins/haml/init.rb:5 /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/plugin.rb:49 /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:25:in `instance_exec' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:25:in `run' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:55:in `run_initializers' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:54:in `each' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:54:in `run_initializers' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:71:in `initialize!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:112:in `initialize_tasks' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/test_unit/testing.rake:45 /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/test_unit/testing.rake:43:in `collect' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/test_unit/testing.rake:43 /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/local/bin/rake:19:in `load' /usr/local/bin/rake:19

    Read the article

  • Rails 3 Beta 2, Haml, Nested Layouts and LocalJumpError

    - by CJ Bryan
    Alright, I'm trying to create an app with nested templates. I'm using Rails 3 Beta 2 and Haml. I've poked around and I've decided to take the clearest approach and have structured my templates like so: # application.html.haml !!! %body %h1 Outermost Template = yield(:foobar) # inner.html.haml - content_for :foobar do %h2 Inner Template = yield = render :file => 'layouts/application' # foo_controller.rb layout 'inner' With all of this, I get a LocalJumpError with the message no block given. The stack traces are blank and pretty unhelpful. Any ideas? Are these known issues?

    Read the article

  • Create a helper or something for haml with ruby on rails

    - by Lisinge
    Hello, i am using haml with my rails application and i have a question how the easiest way to insert this haml code into a html file: <div clas="holder"> <div class=top"></div> <div class="content"> Content into the div goes here </div> <div class="bottom"></div> </div> And i want to use it in my haml document like this: %html %head %body Maybee some content here. %content_box #I want to get the code i wrote inserted here Content that goes in the content_box like news or stuff %body I hope you understand what i want to acomplish here. And if there is a easier way to do it please answer how. Thanks!

    Read the article

  • Haml::SyntaxError in Static#home?

    - by Koning Baard
    I have this Haml: #index-header %h1 Supersonic Mac Software. %p Some motto %h1 Our Software %p Which will once becoume your's .third-column %h2 Product 1 %p LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL .third-column %h2 Product 2 %p LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL .third-column %h2 Product 3 %p LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL LOL And I get this error: Haml::SyntaxError in Static#home Showing app/views/static/home.html.haml where line #5 raised: Illegal nesting: content can't be both given on the same line as %h1 and nested within it. What am I doing wrong? Thanks.

    Read the article

  • Execute ruby code in a link in Haml

    - by thermans
    I want to have a "delete user" link in a normal Activerecord table, but I can't figure out how to wrangle the inline ruby in haml. I have this: %tbody - @users.each do |user| %tr %td= user.name %td= user.login %td %a %img{:src => '../images/delete.png', :title => 'Delete user'} How do I make the - user.destroy be a clickable link in Haml?

    Read the article

  • haml - if-else with different identations

    - by egarcia
    Hi everyone, I'm trying to render a calendar with rails and haml. The dates used come from a variable called @dates. It is a Date range that contains the first and last days to be presented on the calendar. The first day is always sunday and the last one is always monday. I'm planning to render a typical calendar, with one column per weekday (sunday is going to be the first day of the week) using an html table. So, I need to put a %tr followed by a %td on sundays, but the rest of the days I just need a %td. I'm having trouble modelling that on haml. This seems to require different levels of identation, and that's something it doesn't like. Here's my failed attempt: %table %tr %th= t('date.day_names')[0] # Sunday %th= t('date.day_names')[1] %th= t('date.day_names')[2] %th= t('date.day_names')[3] %th= t('date.day_names')[4] %th= t('date.day_names')[5] %th= t('date.day_names')[6] # Monday [email protected] do |date| - if(date.wday == 0) # if date is sunday %tr %td=date.to_s - else %td=date.to_s This doesn't work the way I want. The %tds for the non-sunday days appear outside of the %tr: <tr> <td>2010-04-24</td> </tr> <td>2010-04-25</td> <td>2010-04-26</td> <td>2010-04-27</td> <td>2010-04-28</td> <td>2010-04-29</td> <td>2010-04-30</td> I tried adding two more spaces to the else but then haml complained about improper identation. What's the best way to do this? Note: I'm not interested on rendering the calendar using unordered lists. Please don't suggest that.

    Read the article

  • Postgres error with Sinatra/Haml/DataMapper on Heroku

    - by sevennineteen
    I'm trying to move a simple Sinatra app over to Heroku. Migration of the Ruby app code and existing MySQL database using Taps went smoothly, but I'm getting the following Postgres error: PostgresError - ERROR: operator does not exist: text = integer LINE 1: ...d_at", "post_id" FROM "comments" WHERE ("post_id" IN (4, 17,... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. It's evident that the problem is related to a type mismatch in the query, but this is being issued from a Haml template by the DataMapper ORM at a very high level of abstraction, so I'm not sure how I'd go about controlling this... Specifically, this seems to be throwing up on a call of p.comments from my Haml template, where p represents a given post. The Datamapper models are related as follows: class Post property :id, Serial ... has n, :comments end class Comment property :id, Serial ... belongs_to :post end This works fine on my local and current hosted environment using MySQL, but Postgres is clearly more strict. There must be hundreds of Datamapper & Haml apps running on Postgres DBs, and this model relationship is super-conventional, so hopefully someone has seen (and determined how to fix) this. Thanks!

    Read the article

  • Parsing atom/rss feed containing multiple <link> tags with Haml on RoR

    - by fenderplayer
    So, firstly, heres an atom feed snippet which i am trying to parse: // http://somelink.com/atom <feed xmlns="http://www.w3.org/2005/Atom"> <entry> <title>Title Here</title> <link href="http://somelink.com/link1&amp;amp;ref=rss" rel="alternate" /> <link href="http://somelink.com/link2&amp;amp;ref=rss" rel="tag:somelink.com/apply_url"/> ... </entry> i pull the atom feed like so, // In controller index method @rss = SimpleRSS.parse open('http://somelink.com/atom') Then i output the response in the view, which i am writing using haml, as follows: - @rss.entries.each do |item| .title-div = item.title .title-link = item.link //outputs the first link I could run a second loop for the links but is there a way to get the second link without it? Like reading the "rel" attribute and outputting the correct link? How do i do this in haml/rails?

    Read the article

  • Haml formatting

    - by mathee
    I'm new to haml, so I'm still trying to figure out the formatting. I have an index.haml file with the following code. %h1 Welcome to Solidarity Hello, = @profile.first_name ! It renders like this: Welcome to SolidarityHello, user ! Here's the page source: <h1> Welcome to Solidarity </h1> Hello, frances ! It has a space between @profile.first_name and the exclamation mark. Why is that? And, how do I fix it?

    Read the article

  • Cannot call struct properties from HAML file

    - by Lander
    I have the following code in my controller: @nav_items = ActiveSupport::OrderedHash.new @nav_items[:home] = Struct::NavItem.new("Home", nil, "/", "icon-home") @nav_items[:about] = Struct::NavItem.new("About", nil, "/about", "icon-heart") @nav_items[:contact] = Struct::NavItem.new("Contact", nil, "/contact", "icon-envelope") if (current_user != nil && current_user.admin?) @nav_items[:admin_divider] = Struct::NavItem.new(nil, "divider-vertical", nil, nil) @nav_items[:admin] = Struct::NavItem.new("Admin", nil, "/admin", "") end And the following in my view: - @nav_items.each do |nav_item| %li{ :class => nav_item[:class] } %a{ :href => nav_item[:link] }= nav_item[:text] And my struct definition: Struct.new("NavItem", :text, :class, :link, :icon_class) I'm relatively new to Ruby, Rails, and HAML, but in another project using ERB rendering, code like that worked fine. I've tried referencing properties by doing something like nav_item.link as well, but that still does not work. The error I get with my current code is: Symbol as array index By using code like nav_item.link: undefined method `link' for #< Array:0x126970ff0 As this is my first time using HAML, I'm not too sure what I'm doing wrong.

    Read the article

  • Ruby on Rails: How to verify haml files syntax within rails project?

    - by Acidburn2k
    I've installed HAML into my project and it is working like a charm - the templates are beeing rendered without a problem. My question is how can I do the rendering on the command line, by using HAML program. That would be super for debugging purposes, meantime while I try to compile HAML file I get the error on first Rails related Ruby code to be found: % cat app/views/dashboard/index.html.haml - title "Home" %p Lorem ipsum dolor sit amet... % haml app/views/dashboard/index.html.haml Exception on line 1: undefined method `title' for #<Object:0xb73283b0> Use --trace for backtrace. Page is rendered fine returned correctly through the webserver.

    Read the article

  • Using Haml & Sass with Eclipse

    - by Sam Hasler
    Are there any plugins for eclipse that add syntax highlighting and other niceties for editing Haml and Sass? Google searches only seem to point to a dead project on lucky-dip.net. Note: it's Sass I'm most interested in. A solution for using just Sass (or something similar to it like less) in Eclipse would suit my needs. Also, I'm developing for Google App Engine (Java), using the App Engine plugin for Eclipse. So switching to another IDE isn't an option. Update: So I've got syntax highlighting now using Pascal's answer and I've installed Ruby and Compass to compile sass into css. However I'm aware that the syntax of sass will be changing with 2.4 so I'd still like to get the Haml and Sass Editors that come with Aptana to work. When I tried to use them they threw an exception and wouldn't display the files. I'd be interested to know if that's because I misconfigured Aptana or is an actual bug in the editors. I'd also be very interested in any way of compiling Sass that integrated with Ecplise so that I didn't have to run something separate from it. (or a way of putting Sass/Compass in the Ecplise build process.)

    Read the article

1 2 3 4 5 6 7 8  | Next Page >