Displaying 20 results from an estimated 100 matches similar to: "Static Pages from Railcast"
2012 Jul 19
6
Rendering Partial
I am a bit confused when coming from layout and partials.
To start of I have a file called application.html.erb which has my
layout such has follow
<html>
<head>
<body>
<%= render ''layouts/footer'' %>
</body
</html>
This call a new file _footer.html.erb
This file his has follow
<footer class="footer">
<nav>
<%=
2011 Jul 22
9
Active Record Issue (I think)
I''m following a rails tutorial (Hartl) and it''s been fine so far, but
something doesn''t seem to be working right.
I have two basic models so far, "User" and "Micropost".
class User < ActiveRecord::Base
has_many :microposts
end
class Micropost < ActiveRecord::Base
belongs_to :user
end
If I do something like:
"first_user =
2011 Nov 12
4
No route matches [GET] "/microposts/304"
Hi all,
I''m learning Rails by Example (chapter 11), by Michael Hartl (
http://ruby.railstutorial.org/chapters/user-microposts#top) but I got no
route matches when I try to delete one micropost.
the _micropost html is...
<tr>
<td class="micropost">
<span class="content"><%= micropost.content %></span>
<span
2012 Sep 16
0
tutorail test writing problem
Hello,
I try to follow this tutorial :
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
Im now at chapter 3.2.1.
But the test is still failing even if I do everything according to the
chapter.
My code can be found here : https://github.com/roelof1967/demo_app
And the faiing message is :
Failures:
1) Static pages Home page should have the content ''Sample App''
2013 Mar 02
3
Following railstutorial.org tutorial, how to make the microposts be seen by all?
I am a new learner of Ruby on Rails.
I followed through the railstutorial.org tutorial and I''m trying to
learn off the sample demo app where you can to make microposts and only
the people who are "following" you can see them.
If I wanted to make it so every user can see microposts as an additional
functionality, what are the steps to do that?
--
Posted via
2012 Jul 18
3
Undefined method error
I have been working on a project based on Michael Hartl''s book Ruby on
Rails Tutorial in order to try to teach myself Ruby on Rails. However,
when it tries to render a form designed to allow a user to submit a
small message, I get an error saying, "undefined method `model_name'' for
NilClass:Class". It says the error is at line 1, which is "<%= form_for
2008 Jan 24
3
Help to spec a rails helper method that uses content_for
Hi guys,
I am a Rspec newbie and am having problems creating a spec for a RoR helper
method.
I have in fact already implemented the helper method and am trying to create
retrospective specs. I know its the wrong way to do it but I am still
learning Rspec.
In my view I have a call to a helper method.
<% body_class "users" %>
which sets a CSS class declaration in the content_for
2010 Sep 01
2
Undefined methods: has_selector? and flunk
I''m in the process of updating an app for Rails 3.0 and rspec-rails
2.0.0.beta20. When I''m running my specs (rake spec) I get a large number
of errors caused by two undefined methods
undefined method `has_selector?'' for #<String:0x7fdbd0b5b270>
undefined method `flunk'' for
2010 May 07
2
Rspec beta8: helper methods issues
Hello everybody,
I am experiencing the following problems, I googled quickly but I
couldn''t find any documentation or solution to those issues:
1) the generator rails g rspec:helper does nothing;
2) there seems to be no way to test helper methods as I used to do...
for example
the following spec
it ''should set monday as first day of the week'' do
2010 Jun 20
10
RSpec 2 view example: render_template
On http://github.com/rspec/rspec-rails under "View specs" there''s an
example
describe "events/index.html.erb" do
it "renders _event partial for each event" do
assign(:events, [stub_model(Event), stub_model(Event)])
render
view.should render_template(:partial => "_event", :count => 2)
end
end
Is this indeed correct? From the
2012 Sep 15
2
[RSpec Testing] Methods take two arguments
Hello,
Here is my *pdf_helper.rb* => http://pastebin.com/QU1kTKXk. I want to test,
if self.create method can take more than two arguments. But, when I try to
run my test. It showed
*PdfHelper Should have two arguments
Failure/Error:
create_pdf.should_receive(object,template).with(user,file)
NameError:
undefined local variable or method `create_pdf'' for
2005 Dec 15
4
Database best practices?
I started with rails a few weeks ago and I''ve been very impressed with
the whole framework. My first project after the cookbook was a small
application connecting to Postgres. This was originally a port of an
Access application so I was delighted with the new facilities for
constraint checks, triggers, etc.
As I started to write the front-end though I noticed myself rewriting
the
2012 Aug 16
1
How to create subpages.
What I am trying to do is create subpages within the main page.
So if the top navigation is
- Home
www.example.com/
- About
www.example.com/about
- Contact
www.example.com/contact
- Support
www.example.com/support
I would want a sub navigation under the pages like so;
- Home
www.example.com/
- About
www.example.com/about
----- History
www.example.com/about/history
----- Locations
2010 Jun 20
7
rspec-rails 2.0.0.beta.12 showing undefined method error for route_to
First of all, I''ve been trying to find an answer for this problem all
over the internet without luck.
The thing is that I am using RVM with ruby 1.9.2-head and I created a
new empty gemset. Then I installed bundler gem with:
gem bundler install
That installed the library into the /Users/damselem/.rvm/gems/
ruby-1.9.2-head at rails3/gems directory. Then I went to my rails 3 app
2011 Aug 28
3
rspec-rails render_views doesn't render layouts? / how to check flash isn't rendered
I''m trying to test that "static" pages (they''re ERB, but get cached),
generated through rails, don''t render any stray flash notices left over by
the authentication system (Devise) or wherever else.
I''ve tried writing this controller spec, but it appears that response.body
only renders the template, not its layouts?
describe "so that static
2007 Oct 17
9
@session['user'] vs session[:user]
This might seem really simple to some but just wanted to ask: what is
the difference between @session[''user''] and session[:user] ? and how
would you use each?
And another question, I have the following code:
def get_customer
if @session[''customer'']
@c = Customer.find(@session[''customer''])
end
end
private
def
2010 Aug 30
1
undefined method `route_for' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:
Hello, all, I have this error with my rspec - controller - test, and
yes, I do found the thread with the same error here, but it isn''t
helped me, think it''s not my case.
i have rails -v = Rails 3.0.0.rc, rspec -v = 2.0.0.beta.18 (hope they
should match each other).
my test is here: spec/controllers/posts_controller_spec.rb and i ran
it with command: rspec
2012 Aug 29
7
custom js in rails project
Hello, I have a rails project with one controller and one action, as
simple as posible. And I''m trying to put some custom css and js to my
own index.html.erb (not public/index.html.erb), I inluded this on the
layout file:
layout file:
<!DOCTYPE html>
<html>
<head>
<title>Volei</title>
<%= stylesheet_link_tag "application", :media =>
2013 Mar 02
0
Problems getting rspec testing working in OSX?
Hey Gang,
Running into a weird error when trying to follow puppetlabs'' blog:
https://puppetlabs.com/blog/the-next-generation-of-puppet-module-testing/
I''m running 10.8.2, using default ruby, in an attempt to make my home env a little more sane, (ran into weird rbenv issues at work, which I won''t go into here)
The google tells me not a whole lot. Appreciate any help
2011 Sep 23
1
Need hint. Refresh sortable-list after draging element
Hello,
i implemented a dragable list semilar to railcast 147<http://railscasts.com/episodes/147-sortable-lists> and
it works fine.
Each item of my list has a value wich is accumulated ... like this
- Value A = 3, Sum = 3
- Value B = 4, Sum = 7
- Value C = 1, Sum = 8
When i drag Item C on item A i get this
- Value C = 1, Sum = 8
- Value A = 3, Sum = 3
- Value B = 4,