I changed my laptop for a one with windows 7. I installed rails 2.3.5,
postgres-pr 0.6.3, mongrel 1.1.5 and copied my app that was previously
on a win xp PC. When I launched my server and connected to my app, I had
the following error :
Status: 500 Internal Server Error
uninitialized constant
sorry to say, but your short answer is wrong.
class AppModel ActiveRecord::Base
end
Table 'blog_development.app_models' doesn't exist
My question is, how do I tell Rails not to look for a table named
app_models AND am I even taking the right approach here? Is there a
better way to
would be nice to see your code. how are you trying to do this?
obviously, you don't want to use any escaping (like the h-function
does), but don't forget about security issues like cross-site
scripting.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails:
maybe this is due to your relative path. are you sure the file is
where you think it is? are you sure the current working directory is
what you think it is?
try File::exists?(#{RAILS_ROOT}/path/to/my/file)
another thing: since you obviously left out some code and replaced it
with ... we can't be
whats the name of your file? looking at the class it should be named
*_create_u_r_ls.rb. if it is called *_create_urls.rb then your class
should be CreateUrls. smae with your model. try Url instead of URL.
--
You received this message because you are subscribed to the Google Groups Ruby
on
reverting is easy. just uninstall your current rails-gem. if didn't
uninstall 2.3.4 it should still be there and your done. if you
uninstalled it, just install it with -v=2.3.4.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to
why don't you just write a migration that loops all of those objects
with the old thumbnail-information and call the method that generates
the thumbnails again.
like this:
MyModel.find_all_with_thumbnails.each(:generate_thumbnail)
i'd like to add: i don't know your app and i don't use
if you want an agile approach try setting your goals (and that means
maybe break them down in little pieces) and realize them one after the
other. that means: don't install all your plugins at once, but only
those you need for your next step. write a test like 'User should be
able to login' and
thanks a lot for your replies!
i already changed my :conditions. but i have an additional question
about that: should i change :order-statements accordingly (to also
include the brackets)?
as for my original problem:
thanks matt! your post put me into a new direction. i really found an
old
just tried it. removing the kind_of-attribute did the trick! THANKS!
that bug was really getting annoying.
--
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 rubyonrails-t...@googlegroups.com.
To
%= yield % works like a 'catch-all' inside layout files. if you
don't specify where some code should be rendered it just ends up
there. you could also use %= @content_for_layout %
there is a nice railscast by ryan bates covering that.
--
You received this message because you are subscribed to
maybe i'm wrong, but it could be something like the following:
if your users (=hits) are User.find_by_ferret and thus of the class
User. a user.user would return nil, like in this line:
users.concat(hits.collect { |hit| hit.user }).uniq!
now you have a collection of nils and try to call
%= yield :layout % outputs everything that is created with %
content_for :layout do %...% end %.
here is ryans railscast:
http://railscasts.com/episodes/8-layouts-and-content-for
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to
hallo everybody,
i already googled the following problem, but there are so many
questions regarding has_many :through, that i just couldn't find
what i was looking for. so, i'm really sorry if this has been asked
before. if so, just drop me the link.
i have a has_many :through relationship
and there is always the obvious solution:
1000.times do
Voucher.create(:attribute1 = 'value1')
end
--~--~-~--~~~---~--~~
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
You might wanna change Vorhunden to vorhanden to make it German.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To
you should read-up on REST.
still (without knowing your code) you can just use routes the old
fashioned style like you used to have them in rails 2.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails:
how about making it conditional? check existence of that div
beforehand.
--~--~-~--~~~---~--~~
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
there is a similar thread:
http://www.ruby-forum.com/topic/87505
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To
welcome, you are here. just ask.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send
james already mentioned the best way to do this, but if that doesn't
match your requirements, just write your own helper-method. stuff like
that is not done inside the controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
maybe i misunderstand, but what i see is a helper-method in
application_helper. i don't know how many times you call that method
in one single view, but if you call it only once @rev is not yet set
when you write it into your log file.
does the method return your revision-number correctly?
if
i can recommend this one for a good start:
http://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition
DHH mentioned that it is completly 2.3 ready.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
here you go:
http://mislav.uniqpath.com/rails/install-sqlite3/
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To
plugins are all inside your rails-project's directory. so moving that
would move your plugins with it. and to make sure you got all the gems
just list them (gem list) and reinstall the same version on your new
machine.
--~--~-~--~~~---~--~~
You received this
forgot to state the (even more) obvious: dump your mysql-db to a file
and insert it in your new db.
--~--~-~--~~~---~--~~
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
i think the difference is that form a view there can be a real POST
(with user submitting data, pressing a button, ...), but a controller
just GETs infos and stuff. i'm no expert, so that is just a guess.
normally you POST things that create or destroy things. in other words
actions that make a
@instance.reload
is available for every ActiveRecord-Object.
or you can use
reload!
to reload everything.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send
IIRC reload! is only defined in a console session
that may be right. i never really used it anywhere else than in
console.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this
you can implement as many classes as you like. if you have something
that is common to all of your Tasklist-classes you can of course
create class GenericTasklist that holds the common code and form which
Tasklist inherits.
you should take a look into a book that explains OOP though. without
where exactly is the error?
which expression is nil?
- params[:question]
- params[:question][:id]
- params[:question][:id][:value]
did you debug it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails:
i don't know about your system, but maybe you try to do something over
ssl and you don't have it configured for your webserver?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to
first of all: i don't know if using POST with a redirect is possible.
but other than that: i don't think you really need that.
on the one hand you could just leave that
if request.post?
out and everything is fine. i don't think you really need to check for
POST in logout. the user is not
nice idea. thumbs up.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
Thanks Wolas, actually that worked fine :-)
wow, i just learned something. ignore everything i said so far. i
have to try that immediately...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk
duh. *g*
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
well, you can do that like i posted before.
only thing you have to add is maybe an ajax-call to reload that
textarea.
once you figured how to put default values into that text-area, and
how to replace_html with ajax, this should be no problem. try it.
that's a very personal decision. you gotta try and decide for
yourself.
personally i've been working on mac/textmate for a while and switched
back to suse/kate which is a very good combination for me. my
coworkers are using ubuntu/netbeans though.
don't you just want to render a template like this:
%= render shared/footer %
?
--~--~-~--~~~---~--~~
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
Will the instance method perform_sanity_check have access to @obj1
attributes?
yes, with
self.attribute
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send
If you have a construct like this (all in the same file):
# app/models/user.rb
class User ActiveRecord::Base
# ...
end
class UnassignedUser User
def self.shout
puts yeah
end
end
script/console will behave like this:
UnassignedUser.shout
NameError:
for this text_area:
%= text_area( user, tasks, :cols=30, :rows=10) %
default value would be to set
@user.tasks = text_fields[:user_tasks]
in your controller.
hope this is what you were looking for.
--~--~-~--~~~---~--~~
You received this message because you
[quote]
RailsSpace is an introductory book, so we don't assume any knowledge
of the Ruby programming language or of the Rails framework.
[/quote]
personally i didn't read that book, but judging from the above
statement (taken from the introduction of this book) it should be ok
to get in touch
CGI::Session.expire_after 2.hours
that's not entirely true. the above mentioned code only works with the
dynamic_session_exp plugin. without plugins for CGI::Session there are
only few methods like new or delete (http://www.ruby-doc.org/core/
classes/CGI/Session.html).
you gotta try to install rails 2.3. all other previous versions are
not compatible with 1.9.1.
on the other hand: anything could cause an error of which i don't even
see the error-message...
--~--~-~--~~~---~--~~
You received this message because you are
take a look at the :include = :modelname option.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from
try something like:
sudo gem install rails --source http://gems.rubyonrails.org
--~--~-~--~~~---~--~~
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
you should read up on REST. maybe start here:
http://railscasts.com/episodes/35-custom-rest-actions
--~--~-~--~~~---~--~~
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
depends on what you are looking for. if want to have a one-way
function (for passwords and such) just try it like this:
encrypted_item = Digest::SHA256.hexdigest(“string_to_encrypt”)
you could also use SHA1, SHA384, SHA512 depending on your need of
security.
you'll want to do this client-side to have no client/server-
communication and thus instant loading of your content. rails ships
with prototype, but it's still javascript. so, to answer your
question: use javascript and css. add an observer for mouseover and
then do whatever is necessary (i.e.
requiring your file should make them available for your models. there
is something wrong with your code.
# file.rb
CONSTANT = loaded
# some_model.rb
class SomeModel ActiveRecord::Base
require File.dirname(__FILE__) + '/some/path/to/your/file'
def self.constant_status
puts CONSTANT
you are right. it seems like an error that occurrs after reading your
yml-file. obviously there are some additional whitespaces/carriage
returns added to it. but you could just gsub them.
but other than that, one question: why do you want to save a html
string in a yml-file (and not just read
AJAX-calls (because there are many of them). surely there must be
approaches on that subject already. but it's hard to google without
some keywords to look for.
thanks
MaD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
i just want to know weather it is saved ?
i don want to save it or try to save it !
well, if you dont try to save it, the answer to your question is quite
easy: no.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
i'm gonna try that. thanks!
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send
well, you got a few errors here and there. for example:
path = File.join(directory, user.user_id, filename)
i guess user doesn't have a user_id but an id, so try:
path = File.join(directory, user.id, filename)
if you post your error-message, we can try to get there step by step.
but in
in that view, does
%= course.class %
%= course.semester_id %
give you something like this
Course
32
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send
# controller:
def show_all_models
# require all of your models so they get loaded
Dir.glob(RAILS_ROOT + '/app/models/*.rb').each { |file| require
file }
# find all subclasses of ActiveRecord
@all_models = Object.subclasses_of(ActiveRecord::Base)
end
# view:
ul
% @all_models.each do
since this problem is closely linked to your user's entries, you gotta
solve it in your view or controller. to not repeat yourself too much
you could add a helper-method for that piece of code you are using to
set your records straight.
--~--~-~--~~~---~--~~
You
heavy interface you got there. still, without your code nobody will be
able to tell you where you went wrong.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send
i think your project is a pretty good start. if you are going to code
it all by yourself, maybe even put your authentication-code into a
plugin and in the end try to exchange it with sth. like
restful_athentication, then you got your hands dirty enough to start a
serious project. depending on
oh, yeah i forgot:
- be sure to test your app. either you use the built in test-
framework or something like rspec.
btw: it really doesn't matter which book your reading or which
tutorial you are following. your approach of getting your hands dirty
and trying to build a (not so trivial) app on
well, helpers are really meant for helping with displaying your data.
thats right. i actually didn't mean to write a helper-method, but a
method (in your controller) to help you with setting your records. my
fault (got lost in translating my thoughts).
i think your aproach of putting it into
well, you could always create a helper with an arbitrary name and
include them in your controller. that way helpers are all huddled
together in one folder, but that special controller_helper gets only
included in controller that depend on it.
--~--~-~--~~~---~--~~
your first aproach was this:
def show
@topic = @object
@items = @topic.items
end
where would @object come from. it's a new uninitialized variable (=
nil). that's the reason it didn't work.
what else did you expect than nil.items ?
--~--~-~--~~~---~--~~
You
well, i did look at your code and answered. but still, do you really
think people should search for your older posts to answer your latest
one? your the one who wants some help, so try to supply as much
information on your problem as possible...
for your view, if in doubt use this instead of %= f.file_field
(uploaded_picture) %
input type=file name=chosen_file /
in your controller (the line you commented out):
File.new(path, wb) { |f| f.write(params[:chosen_file].read) }
if i didn't miss anything, this should do the trick.
you could simply write your own helper like that:
def format_phone_number(number)
return (#{number[0..2]})#{number[3..5]}-{number[6..-1]}
end
add it to your view_helper and call it whenever you like.
validations are similar. just add your own validation.
just install RMagick / ImageMagick (there should be a gem for this).
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
vendor/rails/activerecord/lib/active_record/locking/pessimistic:
# Pass tt:lock = true/tt to ActiveRecord::Base.find to obtain
an exclusive
# lock on the selected rows:
# # select * from accounts where id=1 for update
# Account.find(1, :lock = true)
#
# Pass tt:lock =
# this makes param 2 and 3 optional (if none is passed default values
are set to empty string):
def check_chat_type(f, search_string_1=, search_string_2=)
...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on
i really can't answer your questions regarding why this happens, but
for the HOW_TO part i'd suggest to just do it like this:
# controller:
@columns = Source.column_names
# view:
%= @columns %
this respects MVC.
--~--~-~--~~~---~--~~
You received this message
can you set a debugger in your Controller/Model to see what is
actually received?
--~--~-~--~~~---~--~~
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
That's a row lock :-) If you want a table lock you need to run the
appropriate sql statement for your database by hand.
Fred
oh, i'm sorry. it seems i'm still a little bit sleepy and didn't read
the question correctly. i thought you were looking for a row lock...
it all depends on your machine. nobody can tell you what's right (or
even the best) for you. you gotta decide for yourself.
to show you some alternatives:
- you could just work with cron-jobs.
- you could use backgrounDRb or workling/starling to schedule your own
processes.
probably in row 23 of your code!?
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send
how can i know weather it is called or not
set a debugger.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To
at least that token-problem is solved.
but it's still weird, cause that session_expiry code is actually
working on one of my apps. are you sure you don't have some sort of
typo? (sth. like instead of ) i would debug that piece of code to
see, why the session is reset.
btw: 1800 sec is of course
http://gems.rubyforge.vm.bytemark.co.uk/gems/actionmailer-2.2.2.gem
that address seems to be working. have you tried it again?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to
the correct call is:
@primary_photo = @gallery.photos.find(:first, :conditions = {:primary
= true})
or (but thats an old one and i don't know if that isn't deprecated):
@primary_photo = @gallery.photos.find_first_by_primary(true)
--~--~-~--~~~---~--~~
You
or you could add a named_scope to your photo-model:
named_scope :primary, :conditions = { :primary = true }
then your call could be like:
@primary_photo = @gallery.photos.primary.first
this should be the nicest alternative.
--~--~-~--~~~---~--~~
You received
well if you want all the primary photos just use my suggested
named_scope. then you can ask:
@all_primary_photos = Photo.all.primary # or just Photo.primary
@all_galleries = Gallery.all
no loop needed. but if you want to loop, you can do that with
@all_galleries.each do |gallery|
#
http://api.rubyonrails.com/classes/ActionView/Helpers/FormHelper.html
example taken form the above link:
# Note: a @person variable will have been created in the controller.
# For example: @person = Person.new
% form_for :person, @person, :url = { :action = create } do |f|
%
%=
for your permissions problem I'd suggest the implementation of roles
or groups. that way you can add users to groups or give them roles,
which can be checked in a before_filter in your controllers.
sessions:
if you are using activerecordstore (and thus your sessions are saved
in a db-table)
I thought about creating groups, but then won't this complicate things?
I'll have group_pages table, and how do I manage those? can a user
belongs to many groups?
it's actually best to create a many-to-many relationship (user habtm
groups).
there are many plugins outthere that provide just
in which line do you get the error?
probably here:
@child = Child.new(params[:child])
or here:
@filter = Filtersetting.new(params[:filtersetting])
use the debugger (set it before that line) to see what's in your
params-hash. there is probably a key like
:1 = something
then you can find
i answered to this in your other thread...
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this
check installed gems, frozen rails in vendor and environment-entry for
matching version.
which rails version do you intend to use?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post
on your local machine it might give you the ip of your lan/intranet
(from your router). on your server you get the external one given to
you by your isp.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on
how about a before/after_save callback? i guess that would work.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To
sounds a little bit silly, bit i just tried a route like
map.connect ':controller/:action.html'
that is actually working for me
http://localhost:3000/bla/index.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
you just have to set the primary key manually.
@user = User.new(params[:user])
@user.username = params[:username]
@user.save
however for security reasons i would not advise to use mass-assignment
for user-creation anyways. there could be stuff like that in there:
leave out the line
model :contact
you don't need that.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To
sorry i didn't read carefully enough.
try this:
rails project
cd project
script/generate scaffold contact name:string street:string
mail:string
nano config/database.yml
rake db:migrate
script/server
firefox http://localhost:3000/contacts/new
hope this helps.
btw: the tutorial you
basically you got two possibilities:
1. write the value into a session-variable
session[:wtf] = some string or value
2. pass your value as a parameter to some action and read params in
your controller:
view:
%= link_to my_action :controller = :bla, :action
= :my_action, :wtf = some string
Sending again :)
why? was 24 minutes of waiting too long?
I hope now you can understand what my problem is.
no, not really.
anyhow:
pJames, br /Andy, br /Candy/p
this is actually what i thought you are trying to achieve after
reading this:
i used gsub method to replace \r\n to br/
now, i
Just check the link I posted earlier...
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this
not explicitly. it is in fact a has_many relationship, because your
model has_many :rates, but you dont need to write that. the only thing
you have to write in your model is acts_as_rateable.
but that's all in the example.
--~--~-~--~~~---~--~~
You received this
fractional years are no longer respected. convert to integers and use
this instead:
ActiveSupport::CoreExtensions::Integer::Time
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to
plain old javascript. if you don't know how to do it, google helps:
http://www.webdeveloper.com/forum/showthread.php?t=122975
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to
1 - 100 of 263 matches
Mail list logo