I wrote this while trying to index data
= form_tag blog_posts_path, method: :get do
%p
= text_field_tag :query, params[:query]
= submit_tag "Search", name: nil
and I get this error and I really don't know how to fix it:
/home/marina/project/app/views/blog_posts/index.haml:15: syntax error, unexpected ')'
));}\n<p></p>\n#{
^
/home/marina/project/app/views/blog_posts/index.haml:15: syntax error, unexpected '<'
));}\n<p></p>\n#{
^
/home/marina/project/app/views/blog_posts/index.haml:15: unterminated regexp meets end of fail
/home/marina/project/app/views/blog_posts/index.haml:15: syntax error, unexpected $end, expecting keyword_end
Extracted source (around line #15):
12: %br
13:
14: = form_tag blog_posts_path, method: :get do
15: %p
16: = text_field_tag :query, params[:query]
17: = submit_tag "Search", name: nil
18:
Yep, that seems an indentation problem. You should indent once the %p and twice the last two lines.
Related
I'm getting the following error on the rails server when I press my 'new task' button on my app:
Processing by TasksController#new as JS
ERROR: compiling _app_views_tasks__task_form_html_haml__3289363938348847619_70231363971640 RAISED /app/views/tasks/_task_form.html.haml:4: syntax error, unexpected ')'
));}\n</div>\n<div class='modal-body'>\n #{
^
/app/views/tasks/_task_form.html.haml:8: unknown regexp options - dv
/app/views/tasks/_task_form.html.haml:8: syntax error, unexpected $undefined
));}\n</div>\n<div class='modal-footer'>\n #{
^
/app/views/tasks/_task_form.html.haml:8: syntax error, unexpected keyword_class, expecting keyword_do or '{' or '('
));}\n</div>\n<div class='modal-footer'>\n #{
^
/app/views/tasks/_task_form.html.haml:8: syntax error, unexpected $undefined
));}\n</div>\n<div class='modal-footer'>\n #{
^
/app/views/tasks/_task_form.html.haml:10: syntax error, unexpected '}', expecting keyword_end
));}\n</div>\n", -1, false);::Ham...
^
Below is the code on _task_form_html_haml:
.modal-header
%h1 New Task
= simple_form_for task, class: 'clearfix' do |f|
.modal-body
= f.input :title
= f.input :note
= f.input :completed
.modal-footer
= f.submit 'Save', class: 'btn btn-primary'
I've tried to find out more about compiling errors, partials, haml but have had no luck so far. Can anyone point me in the right direction?
You have this line:
= simple_form_for task, class: 'clearfix' do |f|
that looks like it’s opening a block, but there is nothing indented below it to be the blocks contents.
You just need to correctly indent your code:
.modal-header
%h1 New Task
= simple_form_for task, class: 'clearfix' do |f|
.modal-body
= f.input :title
= f.input :note
= f.input :completed
.modal-footer
= f.submit 'Save', class: 'btn btn-primary'
I'm getting this error when requesting this route: direct_appointment_url(#appointment.uuid, :subdomain => #user.name)
direct_appointment_url(#appointment.uuid, :subdomain => #user.name)
TypeError: can't convert Array to String
from ...rvm/gems/ruby-1.9.3-p362#example/gems/actionpack-3.2.12/lib/action_dispatch/http/url.rb:55:in `match'
route is defined as: get "/appointment/:uuid" => "schedule#appointment", as: "direct_appointment"
The values of the two vars passed in to the route matcher are:
appointment.uuid => "a52aff80-5b83-0130-987f-0026080ebf68"
and
#user.name => "example"
More context:
ActionView::Template::Error (can't convert Array to String):
13: Message: <%= #appointment.client_message %>
14: <% end %>
15:
16: View online: <%= direct_appointment_url(#appointment.uuid, :subdomain => #user.name) %>
17:
18: To see your latest appointments, login at: <%= #login_url %>
19: Your username is: <%= #user.email %>
app/views/user_mailer/new_appointment_email.text.erb:16:in `_app_views_user_mailer_new_appointment_email_text_erb__686277782469675039_70200502266100'
app/mailers/user_mailer.rb:13:in `block in new_appointment_email'
app/mailers/user_mailer.rb:12:in `new_appointment_email'
app/controllers/appointments_controller.rb:43:in `block in create'
app/controllers/appointments_controller.rb:42:in `create'
Ah, so much for useful error messages!
looking at the source code for https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/http/url.rb at line 55, (although blank) the previous lines show the error that should have been raised:
if options[:host].blank? && options[:only_path].blank?
raise ArgumentError, 'Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true'
end
once I specified a host, it worked:
direct_appointment_url(#appointment.uuid, :subdomain => "hello", :host
=> "blah")
=> "http://hello.blah/appointment/6a5cc9a0-5b8f-0130-9883-0026080ebf68"
Protip
Don't provide an array of possible hosts to your config file:
config.action_mailer.default_url_options = { :host => ['lvh.me:3000', 'blah.dev'] }
Well, I hate using SO as just a syntax checker, but for the life of me I cannot figure out why I get thi error
where line #8 raised:
unexpected $end, expecting keyword_end
Here is the offending code:
5: <%= f.input :allele2 %>
6: <%= f.input :run_date %>
7:
8: <%=f.association :gmarkers, :collection => Gmarker.all(:order => 'marker'), :prompt => "Choose a Marker", :label => "Marker" %>
9:
I'm using the SimpleForm gem, and am not too familiar with it yet (obviously!)
tia,
--rick
You're missing an <% end %> after your last line there, line 8.
NoMethodError in Projects#index
Showing /home/dave/Documents/exercises/todo/app/views/layouts/application.html.erb where line #18 raised:
undefined method `find' for Symbol:Class
Extracted source (around line #18):
15:
16: <div id="container">
17: <div id="user_nav">
18: <% if user_signed_in? %>
19: Sign in as <%= current_user.email %>. Not you?
20: <%= link_to "Sign out", destroy_user_session_path %>
21: <%else %>
why am i getting this error message?
undefined method `find' for Symbol:Class
im using rails 3.0.7 and devise 1.1.rc0
based on this tutorial http://media.railscasts.com/videos/236_omniauth_part_2.mov
what a lame i just bundle installed devise 1.3.4 and changed secret_token or clear sessions db and *then up and running*
just incase some people might investigate some the cause of this problem just to let you know.
Learning Ruby on rails from Michael Hartl
I am following the book and have come across a problem when inserting an image, the error that is produced is here
SyntaxError in Pages#home
Showing /Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb where line #17 raised:
/Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb:17: syntax error, unexpected ':', expecting ')'
...pend= ( image_tag('logo.png' :alt =>'Sample App' :class =>...
... ^
/Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb:17: syntax error, unexpected ':', expecting ')'
...go.png' :alt =>'Sample App' :class =>"round" ) );#output_b...
... ^
/Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb:17: syntax error, unexpected ')', expecting keyword_end
...mple App' :class =>"round" ) );#output_buffer.safe_concat('
... ^
Extracted source (around line #17):
14: <body>
15: <div class="container">
16: <header>
17: <%= image_tag('logo.png' :alt =>'Sample App' :class =>"round" ) %>
18: <nav class="round">
19: <ul>
20: <li><%= link_to "Home", '#' %></li>
Trace of template inclusion: app/views/layouts/application.html.erb
I have tried altering the the quotes and brckets and different errors are listed but the problem doesn't go away.
Any help would be great thanks.
You need commas between the arguments in the image_tag method:
<%= image_tag('logo.png', :alt =>'Sample App', :class =>"round" ) %>